[TYPO3-mvc] $query->contains('feUser.usergroup', $myGroup) creates incorrect SQL syntax

Domi djgarms at gmail.com
Thu Jan 19 02:25:43 CET 2012


Hello,

in my repository I have a entity with a 1:1 relation to fe_users and 
want to filter all of the entities where its user is in a certain group. 
But the query

$query = $this->createQuery();
$constraint = $query->contains('feUser.usergroup', $group);
$query->matching($constraint);
return $query->execute();

Results in a incorrect syntax: in the join and in the column names the 
table fe_users is missing. Here the sql error:

#1247602160: You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'ON tx_myext_domain_model_client.fe_user=.uid WHERE 
FIND_IN_SET(8,.usergrou' at line 1: SELECT DISTINCT 
tx_myext_domain_model_client.* FROM tx_myext_domain_model_client LEFT 
JOIN ON tx_myext_domain_model_client.fe_user=.uid WHERE 
FIND_IN_SET(8,.usergroup) AND tx_myext_domain_model_client.deleted=0 AND 
tx_myext_domain_model_client.t3ver_state<=0 AND 
tx_myext_domain_model_client.pid!=-1 AND 
tx_myext_domain_model_client.hidden=0 AND 
tx_myext_domain_model_client.starttime<=1326936000 AND 
(tx_myext_domain_model_client.endtime=0 OR 
tx_myext_domain_model_client.endtime>1326936000) AND 
tx_myext_domain_model_client.sys_language_uid IN (0,-1) AND 
tx_myext_domain_model_client.pid IN (1086)

So the table fe_users is missing in the JOIN and in the WHERE clause. If 
I add it manually in a sql browser its valid and working.

Is this a bug or is it not possible in the way I do it?

Best Regards,

Dominic


More information about the TYPO3-project-typo3v4mvc mailing list