由于我必须以某种方式验证登录数据,普通登录扩展无法处理,因此我必须开发一个自定义登录表单。该登录框是分机的一部分。用 extbase 编写。
但我坚持一个基本问题:我如何处理 extbase 中的 fe_users 会话?
我正在开发一个Extbase扩展.其结构是:
Controller - > MyNameController.php域/模型 - > MyName.php
在MyNameController.php或MyName.php中,我想执行像这样的SOAP请求:
(控制器中的示例)
$WebService="http://webservice_direction/webservice.asmx?wsdl";
$username = "username";
$password = "password";
$parametros = array();
$parametros['username'] = $username;
$parametros['password'] = $password;
$WS = new SoapClient($WebService, $parametros);
$result = $WS->myFunction($parametros);
Run Code Online (Sandbox Code Playgroud)
错误:
PHP Fatal error: Class 'NAMESPACE\MyName\Controller\SoapClient' not found in /DirectoryPlugin/Classes/Controller/MyNameController.php on line X
Run Code Online (Sandbox Code Playgroud)
我知道如何在Extbase扩展中包含一个外部类,但我不知道如何包含SOAP或EXCEPTION之类的内容.如何在Extbase控制器中创建这些类的新对象?
在我的扩展中,我阅读了文件夹和图像.但是在结果中总是缺少来自sys_file_metadata的元数据,我什么也没发现如何加载它.
数据库条目在那里,所以文件被索引,一切似乎都没问题.BE工作正常.
这里有一些代码:
控制器操作:
$storageId = 1;
$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
$storage = $storageRepository->findByUid($storageId);
$singleFile = $storage->getFile('/user_upload/my_file.pdf');
$singleFile = true;
$this->view->assign('singleFile', $singleFile);
Run Code Online (Sandbox Code Playgroud)
如果我做af:调试它给我看这个:
Extbase Variable Dump
TYPO3\CMS\Core\Resource\Fileprototypeobject
metaDataLoaded => FALSE
metaDataProperties => array(empty)
indexingInProgress => FALSE
updatedProperties => array(empty)
indexerService => NULL
properties => array(15 items)
storage => TYPO3\CMS\Core\Resource\ResourceStorageprototypeobject
identifier => '/user_upload/my_file.pdf' (24 chars)
name => 'my_file.pdf' (11 chars)
deleted => FALSE
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,有一个字段metaDataProperties和metaDataLoaded,所以它没有被加载.
有人知道如何加载它吗?
我有一个带有图像字段的 extbase 模型,它只是一个存储文件名的 varchar 数据库字段:
/**
* image
*
* @var string
*/
protected $image;
Run Code Online (Sandbox Code Playgroud)
如果我在后端列表视图中查看这个实体,我可以将图像字段添加到列表中,但当然它只显示文件名。是否可以显示缩略图?我该怎么做呢?
任何提示将不胜感激。谢谢!
验证后我有一个表单,如果发生任何错误,页面将重定向到编辑本身,并显示错误消息.如何通过typo3中的redirect()传递先前的数据和错误消息?
$this->redirect($action_name,$controllername, $extensionName, array('data',$data));
Run Code Online (Sandbox Code Playgroud)
这样对吗?
我的行动名称是,'edit'但它重定向到'list'.请帮我解决这个问题.
所以我试图用Typo3设置我的第一个扩展,我非常努力.我想设置一个扩展来处理客户的填海工程.
在提交输入值之后,我将新客户存储在数据库中,并且在此步骤之后,我将直接从数据库中取回它以查看他具有哪个uid,以便在回收中存储来自客户的uid.
所以我不想覆盖当前$customer-variable的
$customer = $this->customerRepository->findByName($name);
Run Code Online (Sandbox Code Playgroud)
返回的结果实际上并不是客户的对象,即使var_dump它是客户对象.我无法调用该功能
$customer->getUid()
Run Code Online (Sandbox Code Playgroud)
获得这个新客户的当前uid.但我需要在我的回收对象中使用客户的uid - 我该怎么做?
下一个问题:每次查询我都会对db做
->findAll(), findByIdentifier($identifier)
Run Code Online (Sandbox Code Playgroud)
是null.
我不知道为什么.似乎他找不到storagePid,但我已正确设置了TypoScript.
我添加时只能查询
$query->getQuerySettings()->setRespectStoragePage(FALSE);
Run Code Online (Sandbox Code Playgroud)
在这种情况下,狗被埋葬的任何想法?
非常感谢你,抱歉我的英语不好:P
在自定义 extbase 扩展中,我们有一个像这样设置的图像字段:
模型
/**
* Returns the picture
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $picture
*/
public function getPicture()
{
return $this->picture;
}
/**
* Sets the picture
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $picture
* @return void
*/
public function setPicture(\TYPO3\CMS\Extbase\Domain\Model\FileReference $picture)
{
$this->picture = $picture;
}
Run Code Online (Sandbox Code Playgroud)
三氯乙烯
'picture' => array(
'exclude' => 0,
'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_address.picture',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'picture',
array(
'appearance' => array(
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
),
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT …Run Code Online (Sandbox Code Playgroud) 我有一个前端扩展,登录用户应添加/编辑 sys_file 记录。
我尝试像这样更新文件元数据(简化):
$uid = (int)$this->request->getArgument('file');
$resourceFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
$file = $resourceFactory->getFileObject($uid);
$file->updateProperties(array(
'title' => $this->request->getArgument('title'),
'keywords' => $this->request->getArgument('keywords'),
'description' => $this->request->getArgument('description'),
'copyright' => $this->request->getArgument('copyright'),
'modification_date' => time()
));
$this->fileRepository->update($file);
$this->addFlashMessage(LocalizationUtility::translate('messages.success.file'));
$this->persistenceManager->persistAll();
Run Code Online (Sandbox Code Playgroud)
persistenceManager 和 fileRepository 通过以下方式注入:
/**
* fileRepository
*
* @var \TYPO3\CMS\Core\Resource\FileRepository
* @inject
*/
protected $fileRepository = NULL;
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
* @inject
*/
protected $persistenceManager;
Run Code Online (Sandbox Code Playgroud)
并且通常我没有收到任何错误,会显示 Flash 消息,流体表单甚至会显示表单内的新数据,但实际上并未保存。
有什么方法可以调试/解决这个问题?似乎 $fileRepository 实际上并没有执行“更新”语句,是否有某种我需要在前端规避的权限检查?
此按钮的用途类似于隐藏按钮,我想将“热门新闻”标志从1更改为0,从0更改为1。
我不知道从哪里开始,我发现隐藏的按钮是如何工作的,但是我不知道如何添加自己的按钮并使用它。如果可能的话,请添加指向扩展的任何链接,这些链接都有解决该问题的方法,或者提供了解决该问题的代码,否则其他任何方法都将非常有用。
谢谢!
我有一个关于 TYPO3 9.5 中 enablecolumns 和 QueryBuilder 的问题:
在 TCA 中,我定义了 enablecolumns:
'ctrl' => [
'title' => '....'
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'versioningWS' => 2,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent',
'transOrigDiffSourceField' => 'l18n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'fe_group' => 'fe_group',
],
]
Run Code Online (Sandbox Code Playgroud)
在存储库中,我创建了一个自定义查询:
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_myext_domain_model_table');
$result = $queryBuilder
->select('*')
->from('tx_myext_domain_model_table')
->where($where)
->execute();
Run Code Online (Sandbox Code Playgroud)
如果我调试 SQL
$queryBuilder->getSQL();
Run Code Online (Sandbox Code Playgroud)
我看到已删除和隐藏的条件,但没有 fe_group
如果我添加
$queryBuilder
->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(FrontendGroupRestriction::class))
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(HiddenRestriction::class));
Run Code Online (Sandbox Code Playgroud)
在执行查询之前,添加了 …
extbase ×10
typo3 ×10
fal ×3
php ×2
soap ×1
typo3-6.2.x ×1
typo3-7.6.x ×1
typo3-8.x ×1
typo3-9.x ×1