I want to join two tables in order to show the details in datagrid.
Table 1: student
- primary key : id
- foreign key : class_id
Table 2: class
- primary key : id
class can have many students. (one to many relationship)
Any suggestions would be appreciated.
I'm using OroCRM
You need to add join part to your datagrid.yml configuration. Here is an example in documentation: https://oroinc.com/orocrm/doc/2.6/dev-guide/entities/datagrids#data-source
join: left: - { join: student.class, alias: class }Considering that you created entities with the correct mappins. More details can be found here - https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/unitofwork-associations.html https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html#one-to-many-bidirectional