[FLOW3-general] QueryInterface orderBy OneToMany property
Robin Lehrmann
role at vkf-renzel.de
Mon Nov 5 12:47:45 CET 2012
Hello together.
I create a Query and set an ordering with an OneToMany property.
My two Models:
Customer:
protected $name;
@OEM\OneToMany(mappedBy="customer", cascade={"remove"})
protected $products;
Product:
protected $name;
@ORM\ManyToOne(inversedBy="products")
protected $customer;
Now I want to fetch all customers ordered by products ASC.
The customer with existing products first:
Customer A has 3 Products
Customer B has 1 Products
Customer C has 0 Products
my repository method:
$query = $this->createQuery();
return $query->setOrderings(array('products' =>
\TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING))->execute();
It returns NULL? Maybe I should ordered by the count of products? I dont
know.
Please Help me!
Cheers, Robin.
More information about the FLOW3-general
mailing list