APY / APYDataGridBundle

Symfony Datagrid Bundle
MIT License
494 stars 343 forks source link

Handle Array Collection datas #923

Open OuterAlt opened 7 years ago

OuterAlt commented 7 years ago

Hello everyone,

I have a relation between two entities, with the following files (I'm working with Symfony 3.1) : ---- Projects.php `/**

---- AnrPieces.php ` /**

This works well. Basically in the Controller, if i would like to get all "AnrPieces" for a given project, i would do the following : $project->getAnrPieces(); and the result will be an ArrayCollection, containing all my "AnrPieces" for my project.

I'm trying to do the same with the bundle, but i can't manage to get the datas. I've looked in the doc though, without finding what i was looking for.

Does someone managed to handle it ? Or is there a way to do it ?

Best regards, Thomas

DonCallisto commented 7 years ago

You should use Entity Source and take advantage of QueryBuilder by annotating entity fields.

We added this DoctrineExtension

orm:
  entity_managers:
    default:
      dql:
        string_functions:
          group_concat: DoctrineExtensions\Query\Mysql\GroupConcat

and annotated fields as follows

tags.name:group_concat:distinct

This should work.

OuterAlt commented 7 years ago

Hello @DonCallisto ,

Thanks for replying ! I'll try your solution when i got some time and tell you if it'll work or not.

Best regards, Thomas

DonCallisto commented 7 years ago

Good luck Thomas! 😄

DonCallisto commented 7 years ago

@OuterAlt is this resolved?