Project

General

Profile

Bug #70948

Updated by Christian Kuhn about 9 years ago

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" 
 <pre> 

 »···'pages_list' 

	 'pages_list' => array( 
 »···»···'exclude' 
		 'exclude' => 1, 
 »···»···'label' 
		 'label' => 'List of associated pages', 
 »···»···'config' 
		 'config' => array( 
 »···»···»···'type' 
			 'type' => 'select', 
 »···»···»···'foreign_table' 
			 'foreign_table' => 'pages', 
 »···»···»···'size' 
			 'size' => '8', 
 »···»···»···'maxitems' 
			 'maxitems' => 100, 
 »···»···»···'autoSizeMax' 
			 'autoSizeMax' => 10, 
 »···»···»···'renderMode' 
			 'renderMode' => 'tree', 
 »···»···»···'treeConfig' 
			 'treeConfig' => array( 
 »···»···»···»···'parentField' 
				 'parentField' => 'pid', 
 »···»···»···»···'appearance' 
				 'appearance' => array( 
 »···»···»···»···»···'expandAll' 
					 'expandAll' => TRUE, 
 »···»···»···»···»···'showHeader' 
					 'showHeader' => TRUE, 
 »···»···»···»···»···'maxLevels' 
					 'maxLevels' => 99, 
 »···»···»···»···), 
 »···»···»···), 
 »···»···), 
 »···»···'l10n_mode' 
				 ), 
			 ), 
		 ), 
		 'l10n_mode' => 'exclude', 
 »···»···'l10n_display' 
		 'l10n_display' => 'defaultAsReadOnly', 
	 ), 
 »···), 
 </pre> 

 In The ReferenceRepository I need to select all References assigned to a page. 

 <pre> 
 »···public 
	 public function findByPage($pageId) { 
 »···»···$references 
		 $references = NULL; 
 »···»···$query 
		 $query = $this->createQuery(); 
 »···»···$query->getQuerySettings()->setRespectStoragePage(FALSE); 

 »···»···$constraint 
		 $query->getQuerySettings()->setRespectStoragePage(FALSE); 

		 $constraint = $query->contains('pagesList', $pageId); 
 »···»···$query->matching($constraint); 
 »···»···$references 
		 $query->matching($constraint); 
		 $references = $query->execute(); 
 »···»···return 
		 return $references; 

 »···} 

	 } 
 </pre> 

 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. 

 <pre> 
 SELECT    tx_vender_domain_model_reference.* tx_freudenberg_domain_model_reference.* FROM tx_vender_domain_model_reference·· 
 »···WHERE tx_freudenberg_domain_model_reference   
	 WHERE FIND_IN_SET('44', tx_vender_domain_model_reference.pages_list)· 
 »···»···AND tx_freudenberg_domain_model_reference.pages_list)  
		 AND ( 
 »···»···»···tx_vender_domain_model_reference.sys_language_uid 
			 tx_freudenberg_domain_model_reference.sys_language_uid IN (2,-1)· 
 »···»···»···OR (2,-1)  
			 OR ( 
 »···»···»···»···tx_vender_domain_model_reference.sys_language_uid=0· 
 »···»···»···»···AND tx_vender_domain_model_reference.uid 
				 tx_freudenberg_domain_model_reference.sys_language_uid=0  
				 AND tx_freudenberg_domain_model_reference.uid NOT IN ( 
 »···»···»···»···»···SELECT tx_vender_domain_model_reference.l10n_parent 
					 SELECT tx_freudenberg_domain_model_reference.l10n_parent FROM tx_vender_domain_model_reference· tx_freudenberg_domain_model_reference  
					 WHERE tx_freudenberg_domain_model_reference.l10n_parent>0 
					 AND tx_freudenberg_domain_model_reference.sys_language_uid=2  
					 AND tx_freudenberg_domain_model_reference.deleted=0 
				 ) 
			 ) 
		 ) 
 »···»···»···»···»···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 
 »···»···»···»···) 
 »···»···»···) 
 »···»···) 
 </pre>· 

 </pre>  

 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. 

Back