[TYPO3-mvc] repository issue with contains
Patrick Schriner
patrick.schriner at diemedialen.de
Wed Jan 14 12:37:33 CET 2015
If you have a condition no company.member a company-enablefields check
will be added to your query unless you unless you explicitly request
enableFields to be ignored (by setRespectEnableFields(FALSE)) (in which
case you will have to add those yourself (e.g. for the main model)).
If you want to check your query, you can use the following trick:
$GLOBALS['TYPO3_DB']->debugOutput = 2;
$query->execute()->toArray();
$GLOBALS['TYPO3_DB']->debugOutput = FALSE;
Will show you all SQL queries performed by your query (minus a possible
modification e.g. due to pagination).
Patrick
On Tue, 13 Jan 2015 11:24:56 +0100, Frank Krüger
<fkrueger-ml at mp-group.net> wrote:
> Hi List,
>
> I got a strange issue on a repositories or-chained contraints (TYPO3
> 6.2):
>
> The following contraints are part of a repository function, 'member' is
> defined as object storage in model 'company':
>
>
> $orConstraints = array(
> $query->equals('owner', $user),
> $query->contains('project.pm', $user),
> $query->contains('company.member', $user)
> );
>
> // *** add or constraints
> array_push($constraints, $query->logicalOr($orConstraints));
>
>
> This works well, but when company is NULL, it seems that the whole
> orConstraints-array is ignored.
>
> Any hint would be great.
>
> Cheers,
> Frank
More information about the TYPO3-project-typo3v4mvc
mailing list