[TYPO3-mvc] Confusing result with "custom" findBy* function

Søren Malling soren.malling at gmail.com
Thu Mar 25 13:53:19 CET 2010


Hi,

I've created a "custom" findBy* using the $object->__call() function.

The reason why _call() is used, is because the final method is defined
by some dynamic arguments given.

My problem is that, writing the findBy function manually return the
correct result set, while using the __call function with same
methodName i get no result. The functions are as follows

print_r($repo->findByDistrict(6));	
print_r($repo->__call('findByDistrict', (int)6));

By writing a non existing field as method name, I found that the _call
function creates a "wrong" (well, compared to what I expected :-P)
MySQL statement

 	SELECT tx_groupmembers_domain_model_club.* FROM
tx_groupmembers_domain_model_club WHERE
tx_groupmembers_domain_model_club.district IS NULL AND
tx_groupmembers_domain_model_club.deleted=0 AND
tx_groupmembers_domain_model_club.t3ver_state<=0 AND
tx_groupmembers_domain_model_club.hidden=0 AND
tx_groupmembers_domain_model_club.sys_language_uid IN (0,-1) AND
tx_groupmembers_domain_model_club.pid IN (34)

The wrong part is the

tx_groupmembers_domain_model_club.district IS NULL

where it should be

tx_groupmembers_domain_model_club.district = '6'

which is corectly created when using the
$object->findByDistrict((int)6); function.

Can anyone tell me, why this is the case and maybe point me to a failure?

Thanks in advance,

Søren

-- 
Officially Certified TYPO3 Integrator


More information about the TYPO3-project-typo3v4mvc mailing list