Bug #70948
closedrepository doesn't handle l10n_mode "exclude" in some case
0%
Description
I have a custom recordtype (reference) which needs to be linked to a couple of pages. That link should not be changed in a translation overlay. So l10n_mode is exclude.
So I created the following TCA-Definition for that field "pages_list"
»···'pages_list' => array( »···»···'exclude' => 1, »···»···'label' => 'List of associated pages', »···»···'config' => array( »···»···»···'type' => 'select', »···»···»···'foreign_table' => 'pages', »···»···»···'size' => '8', »···»···»···'maxitems' => 100, »···»···»···'autoSizeMax' => 10, »···»···»···'renderMode' => 'tree', »···»···»···'treeConfig' => array( »···»···»···»···'parentField' => 'pid', »···»···»···»···'appearance' => array( »···»···»···»···»···'expandAll' => TRUE, »···»···»···»···»···'showHeader' => TRUE, »···»···»···»···»···'maxLevels' => 99, »···»···»···»···), »···»···»···), »···»···), »···»···'l10n_mode' => 'exclude', »···»···'l10n_display' => 'defaultAsReadOnly', »···),
In The ReferenceRepository I need to select all References assigned to a page.
»···public function findByPage($pageId) { »···»···$references = NULL; »···»···$query = $this->createQuery(); »···»···$query->getQuerySettings()->setRespectStoragePage(FALSE); »···»···$constraint = $query->contains('pagesList', $pageId); »···»···$query->matching($constraint); »···»···$references = $query->execute(); »···»···return $references; »···}
The resulting sql-query doesn't seem to respect the l10n_mode, since it requires the translated record (sys_language_uid > 0) to be assigned to that page (in this case 44), which would make sense, if that field would be translatable.
SELECT tx_vender_domain_model_reference.* FROM tx_vender_domain_model_reference·· »···WHERE FIND_IN_SET('44', tx_vender_domain_model_reference.pages_list)· »···»···AND ( »···»···»···tx_vender_domain_model_reference.sys_language_uid IN (2,-1)· »···»···»···OR ( »···»···»···»···tx_vender_domain_model_reference.sys_language_uid=0· »···»···»···»···AND tx_vender_domain_model_reference.uid NOT IN ( »···»···»···»···»···SELECT tx_vender_domain_model_reference.l10n_parent FROM tx_vender_domain_model_reference· »···»···»···»···»···WHERE tx_vender_domain_model_reference.l10n_parent>0 »···»···»···»···»···AND tx_vender_domain_model_reference.sys_language_uid=2· »···»···»···»···»···AND tx_vender_domain_model_reference.deleted=0 »···»···»···»···) »···»···»···) »···»···)·
So this query returns all non-translated records which are assigned to that page (no translation overlay existing), and translated record-overlay rows which are assigned to that page (44) - which is not possible, and will always result in an empty set
For better readability I removed the usual hidden=0, deleted=0.
If anyone asks - TCE-Forms do work perfect.