[TYPO3-mvc] need help on implementing MM_match_fields in persistence layer

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jan 7 16:02:25 CET 2010


Hi Robert,

> $query->matching(
> 	$query->logicalOr(
> 		$query->logicalOr(
> 			$query->like($fields[0], $queryParams['query']), $query->like($fields[1], $queryParams['query'])
> 		),
> 		$query->like($fields[2], $queryParams['query'])
> 	)
> );
>
> Does that help?

partly. I knew there is something like ->logicalAnd etc. but I was 
looking for a way to concatenate every constrain of a array in one go. 
Something like: $query->logicalAnd($array);

For now I used some ugly loop construct.

foreach($matchFields as $fieldName => $value) {
	$matchCondition = $query->equals($relationTableName.'.'.$fieldName, 
$value);
	$conditions = $query->logicalAnd($conditions, $matchCondition);
}
$query->matching($conditions);


but that doesn't seem to work like expected using the relationTableName 
inside this MM query.
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list