public function listAction(RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, EntityReflectionInterface $entity)
    {
        $name = $this->get('orchestra.resolver.repository_name')->getName($repository_definition);

        if (false === $entity->isListable()) {
            throw new DomainErrorException('Entity '.$entity->getName().' is not listable. Maybe you forgot to implement ListableEntityInterface?');
        }

        // Get objects to show
        $objects = $repository->listing();

        // Do not use empty, Doctrine Collection does not support it, only count
        $noData = (0 === count($objects));

        // We will also need titles for our table header
        $headers = [];
        if (false === $noData) {
            $headers = $this->get('orchestra.resolver.listing_header')->getHeaders($objects[0], 'viewListing');
        }

        // Finally, we need the routes for each entity
        $actions = $this->get('orchestra.core_entity.action_collection_builder')->build($entity);

        return $this->render('RomaricDrigonOrchestraBundle:Generic:list.html.twig', [
            'actions'   => $actions,
            'headers'   => $headers,
            'no_data'   => $noData,
            'objects'   => $objects,
            'title'     => $name
        ]);
    }
public function listAction(RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, EntityReflectionInterface $entity)
    {
        $name = $this->get('orchestra.resolver.repository_name')->getName($repository_definition);

        if (false === $entity->isListable()) {
            throw new DomainErrorException('Entity '.$entity->getName().' is not listable. Maybe you forgot to implement ListableEntityInterface?');
        }

        // Get objects to show
        $objects = $repository->listing();

        // Do not use empty, Doctrine Collection does not support it, only count
        $noData = (0 === count($objects));

        // We will also need titles for our table header
        $headers = [];
        if (false === $noData) {
            $headers = $this->get('orchestra.resolver.listing_header')->getHeaders($objects[0], 'viewListing');
        }

        // Finally, we need the routes for each entity
        $actions = $this->get('orchestra.core_entity.action_collection_builder')->build($entity);

        return $this->render('RomaricDrigonOrchestraBundle:Generic:list.html.twig', [
            'actions'   => $actions,
            'headers'   => $headers,
            'no_data'   => $noData,
            'objects'   => $objects,
            'title'     => $name
        ]);
    }
public function listAction ( RepositoryDefinitionInterface $ repository_definition , RepositoryInterface $ repository , EntityReflectionInterface $ entity ) { $ name = $ this -> get ( 'orchestra.resolver.repository_name' ) -> getName ( $ repository_definition ) ; if ( false === $ entity -> isListable ( ) ) { throw new DomainErrorException ( 'Entity ' . $ entity -> getName ( ) . ' is not listable. Maybe you forgot to implement ListableEntityInterface?' ) ; } // Get objects to show $ objects = $ repository -> listing ( ) ; // Do not use empty, Doctrine Collection does not support it, only count $ noData = ( 0 === count ( $ objects ) ) ; // We will also need titles for our table header $ headers = [ ] ; if ( false === $ noData ) { $ headers = $ this -> get ( 'orchestra.resolver.listing_header' ) -> getHeaders ( $ objects [ 0 ] , 'viewListing' ) ; } // Finally, we need the routes for each entity $ actions = $ this -> get ( 'orchestra.core_entity.action_collection_builder' ) -> build ( $ entity ) ; return $ this -> render ( 'RomaricDrigonOrchestraBundle:Generic:list.html.twig' , [ 'actions' => $ actions , 'headers' => $ headers , 'no_data' => $ noData , 'objects' => $ objects , 'title' => $ name ] ) ; }
Action used when a repository "listing" is called

@param RepositoryDefinitionInterface $repository_definition
@param RepositoryInterface $repository
@param EntityReflectionInterface $entity
@throws DomainErrorException
@return \Symfony\Component\HttpFoundation\Response
Action used when a repository listing is called