[TYPO3-mvc] Adding new constraints to existing constraints in widget query
Helmut Hummel
helmut.hummel at typo3.org
Fri Aug 1 16:35:40 CEST 2014
Hi!
On 01.08.14 16:18, Torsten Schrade wrote:
> I have a custom widget that gets the original query with
> $this->objects->getQuery(), adds some constraints with
> $query->matching() and executes it. So far so good. But what if the
> original query already contained some constraints?
You can get the current constraint(s) with:
$constraint = $query->getConstraint();
And can add further constrainst with:
$newConstraints[] = $constraint;
$newConstraints[] = $query->like('foo', 'bar');
$query->matching($query->locicalAnd($newConstraints));
HTH
Kind regards,
Helmut
--
Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 Core Developer, TYPO3 Security Team Member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-project-typo3v4mvc
mailing list