I am trying to add a column to my table that is calculated (select count ...)
I have a table address and other tables that have a ManyToOne relation to the address table.
In my AddressRepository the query looks like this:
return $this->createQueryBuilder('a')
->select('a.street', 'a.zip', 'a.city')
->addSelect('(
SELECT count(t.id) FROM App\Entity\Table01 t
WHERE t.address = a.id
) as tCount')
->getQuery()
->getResult();
and I am able to receive an array as output with exact 4 columns.
I tried to put this to the ORMAdapater to use the datatables logic for ordering, pagination etc. but I was not able to do it.
Within the documentation I couldn't find something to achieve my goal.
If someone could give me just a hint I would also be happy to enhance the documentation for this.
My current solution is to use the ArrayAdapter and parse the request with my own logic. This solution is definetly not what I want.
Hi,
I am trying to add a column to my table that is calculated (select count ...) I have a table address and other tables that have a ManyToOne relation to the address table.
In my AddressRepository the query looks like this:
and I am able to receive an array as output with exact 4 columns.
I tried to put this to the ORMAdapater to use the datatables logic for ordering, pagination etc. but I was not able to do it. Within the documentation I couldn't find something to achieve my goal.
If someone could give me just a hint I would also be happy to enhance the documentation for this.
My current solution is to use the ArrayAdapter and parse the request with my own logic. This solution is definetly not what I want.
Best regards Michael