[Flow] Find all Objects with an empty Collection
David Sporer
david.sporer at gmail.com
Mon Jan 20 21:39:59 CET 2014
Sorry.. I shouldn't use this Online Tool to format things...
Hi,
I have a Model containing an 1:n relationship:
/**
* The pushNotificationRegistrations
* @var
\Doctrine\Common\Collections\Collection<\My\Project\Domain\Model\Registration>
* @ORM\OneToMany(mappedBy="User")
*/
protected $registrations;
Is it possible to find all Objects where the count of the Collection is 0?
I tried this in the Repository but it doesn't work:
public function countEmpty(){
$query = $this->createQuery();
return $query->matching($query->equals('registrations.count',
0))->count();
}
But this doesn't seem to work.
Do you have an idea how to solve this?
Regards
David
2014/1/20 David Sporer <david.sporer at gmail.com>
> Hi,
> I have a Model containing an 1:n relationship:/** * The
> pushNotificationRegistrations * @var
> \Doctrine\Common\Collections\Collection<\My\Project\Domain\Model\Registration>
> * @ORM\OneToMany(mappedBy="User") */ protected $registrations;
> Is it possible to find all Objects where the count of the Collection is
> 0?I tried this in the Repository but it doesn't work:public function
> countEmpty(){ $query = $this->createQuery(); return
> $query->matching($query->equals('registrations.count', 0))->count(); }
> But this doesn't seem to work.
> Do you have an idea how to solve this?
> RegardsDavid
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>
More information about the Flow
mailing list