APYDataGridBundle icon indicating copy to clipboard operation
APYDataGridBundle copied to clipboard

Using Data Transfer Objects (DTO) with APYDataGridBundle

Open MaxandreOgeret opened this issue 7 years ago • 2 comments

Hello everyone. And sorry for the last post with no description.

Since Doctrine 2.4 a new operator has been created to work with DTOs : "NEW". http://doctrine-orm.readthedocs.io/en/latest/reference/dql-doctrine-query-language.html#new-operator-syntax

It allows to hydrate an DTO object (wich is not an entity) directly from a DQL query. You can customize the DTO as you wish. So doctrine will return an array of hydrated DTO objects :

image

I think it would be really interesting, more efficient and handier to build grids directly from an array of DTOs. I have a lot of troubles with standard doctrine entities and DQL. We had to create DB views. I would be simpler than entities or vectors. what do you think?

Can you help me editing the bundle to make it work with DTOs?

I'm currently working on this and i'm encoutering problems as the bundle expects a Doctrine Entity : The class 'Mobilite\MainBundle\DTO\Consolidation\XXXXXXXXXDTO' was not found in the chain configured namespaces Mobilite\MainBundle\Entity, Mobilite\UserBundle\Entity, FOS\UserBundle\Model

Thanks a lot for your help!

MaxandreOgeret avatar Jul 03 '17 08:07 MaxandreOgeret

@hmert could you or any other collaborator take a look at this? I'm currently engaged in test coverage and I cannot follow this, even for an evaluation.

Thanks.

DonCallisto avatar Jul 03 '17 09:07 DonCallisto

I think I should create a new source type (like Document, Entity or Vector) named "DTO"

MaxandreOgeret avatar Jul 03 '17 13:07 MaxandreOgeret