[TYPO3-mvc] Confusing result with "custom" findBy* function
Søren Malling
soren.malling at gmail.com
Thu Mar 25 14:11:39 CET 2010
I've found the issue.
In the source code it expects the parameter (second argument) to be
array. So instead of
$repo->__call('findByDistrict', (int)6))
it should be
$repo->__call('findByDistrict', array((int)6)))
and the object is nicely returned :-)
On Thu, Mar 25, 2010 at 1:53 PM, Søren Malling <soren.malling at gmail.com> wrote:
> 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
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
--
Officially Certified TYPO3 Integrator
More information about the TYPO3-project-typo3v4mvc
mailing list