TYPO3 单个查询按另一个表过滤 [英] TYPO3 individual query filter by another table
本文介绍了TYPO3 单个查询按另一个表过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 TYPO3 版本 7.6.18,并且想要通过另一个关系表上的字段过滤来获取数据.
I have TYPO3 version 7.6.18, and want get data with filtering by field on another relation table.
class PhotoRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
public function getFiltered($offset = 0, $limit = 5){
$query = $this->createQuery();
$query->matching($query->in('cruserId.gender', 3));
return $query->execute();
}
}
型号:
class Photo extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* CruserId
*
* @var \Fhk\Feusersplus\Domain\Model\User>
*/
protected $cruserId;
/**
* Returns the cruserId
*
* @return \Fhk\Feusersplus\Domain\Model\User> $cruserId
*/
public function getCruserId()
{
return $this->cruserId;
}
/**
* Sets the cruserId
*
* @return void
*/
public function setCruserId($cruserId)
{
$this->cruserId = $cruserId;
}
}
还有我的 TCA:
'cruser_id' => [
'exclude' => 1,
'label' => 'LLL:EXT:fefiles/Resources/Private/Language/locallang_db.xlf:tx_fefiles_domain_model_photo.cruser_id',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'fe_users',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
]
],
那行不通.我得到错误.我不知道这个错误是什么,因为它没有放在错误日志中.我想可能是我应该在 ext_typoscript_setup.txt 或其他地方写关系?我想我应该在某处做参考,但我不知道
That not works. I get error. I don't know what is this error because it not put in error log. I think may be I should write relation in ext_typoscript_setup.txt or somewhere? I think I should make reference somewhere, but I don't know
推荐答案
问题出在错误的 TCA 中.正确的 TCA 是:
Problem was in wrong TCA. The right TCA is :
'cruser_id' => [
'exclude' => 1,
'label' => 'LLL:EXT:fefiles/Resources/Private/Language/locallang_db.xlf:tx_fefiles_domain_model_photo.cruser_id',
'config' => [
'type' => 'group',
'foreign_table' => 'fe_users',
'minitems' => 0,
'maxitems' => 1,
'appearance' => [
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1
],
]
],
这篇关于TYPO3 单个查询按另一个表过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文