Symfony2 KnpPaginator bundle Get Data from multiple entities and render in one Grid/Pagination

393 Views Asked by At

I have a scenario where a role called MIS_Data_Entry. The Job of role is to input data in muliple entites. but it's key field `verified is set to false'. The MIS_Manager recieves these data and either accept it or reject. Now for MIS_Data_Entry. I have to show him all the data from multiple entities into one page/Grid.

  public function indexAction()
    {
            $em = $this->getDoctrine()->getManager();
            $user = $this->getUser();
            $userId = $user->getId();
            $boards = $em->getRepository('PNCMISDashboardBundle:ExaminationBoards')->findBoardToVerified($userId);
            $institutes = $em->getRepository('PNCInstitutesBundle:Institutes')->findInstituteToVerified($userId);


            return $this->render('PNCMISDashboardBundle:Outbox:index.html.twig', array(
                'boards'=> $boards,
                'institutes'=>$institutes,
            ));


    }

New to symfony, don't understand how can i join these two results into one and renders the pageination.

on pagination i will only show Entity Name, Subject, Created on , Statas[verfied or not], show detail. on clicking show details pop up model will dispaly the detail resut of every row. How can i do this.

UPDATE

Most of these entities are not related to each other and some are. But the thing is that they all have createdby key that is associated with the user. So i need to get all these record from multiple tables and combined them to show in one pagination.

1

There are 1 best solutions below

1
On

Do you want to use Symfony's pagination component/KnpPaginatorBundle? Do boards and institutes have a relation? If so, you need to give it a query object using Doctrine Query Builder. It shouldn't be a problem if you understand SQL.

Otherwise, tell us more about your problem. What these entities represent, how are they related?