[FLOW3-general] Repository Query with isEmpty

Karsten Dambekalns karsten at typo3.org
Sat Sep 8 09:34:01 CEST 2012


Hi.

On 05.09.12 15:46, flow3 at leakx.net wrote:
> Hello.
> 
> That is my method:
> 
> public function findAllWithoutCategory() {
>     $query = $this->createQuery();
>     return $query->matching($query->isEmpty('category'))
>         ->setOrderings(array('name' =>
> \TYPO3\FLOW3\Persistence\QueryInterface::
>         ORDER_ASCENDING))
>         ->execute();
> }
> 
> I want to fetch all rows who has an empty entry in the column `category`.
> 
> What is wrong ?
> 

isEmpty() is documented like this:
 -----
Returns an "isEmpty" criterion used for matching objects against a query.
It matches if the multivalued property contains no values or is NULL.
 -----

equals() is documented like this:
 -----
Returns an equals criterion used for matching objects against a query.

It matches if the $operand equals the value of the property named
$propertyName. If $operand is NULL a strict check for NULL is done. For
strings the comparison can be done with or without case-sensitivity.
 -----


So, using isEmpty() should work if - as you say - it works when using
equals() to compare against NULL.

Would you open an issue on Forge, please?
 http://forge.typo3.org/projects/package-typo3-flow3/issues/new

Regards,
Karsten
-- 
Karsten Dambekalns
TYPO3 Core Developer, FLOW3 / Phoenix Team

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the FLOW3-general mailing list