public function customAction($entity, $action, $id = null, Request $request)
    {
        $entityConfig = $this->get('lin3s_admin.configuration.factory.entity')->createFor($entity);
        $entityObject = null;
        $repository = $this->get($entityConfig->repositoryServiceId());
        $entityConfig->loadRepository($repository);

        if ($id) {
            $entityObject = $repository->find($entityConfig, $id);
        }
        if ($id && !$entityObject) {
            throw $this->createNotFoundException(
                sprintf(
                    '%s not found for id "%s"',
                    $entityConfig->name(),
                    $id
                )
            );
        }
        try {
            $callableAction = $entityConfig->getAction($action);
        } catch (\Exception $e) {
            throw $this->createNotFoundException(
                sprintf(
                    'Action "%s" for entity "%s" not found, did you registered it in the config?',
                    $action,
                    $entity
                )
            );
        }

        return $callableAction->execute($entityObject, $entityConfig, $request);
    }
public function customAction($entity, $action, $id = null, Request $request)
    {
        $entityConfig = $this->get('lin3s_admin.configuration.factory.entity')->createFor($entity);
        $entityObject = null;
        $repository = $this->get($entityConfig->repositoryServiceId());
        $entityConfig->loadRepository($repository);

        if ($id) {
            $entityObject = $repository->find($entityConfig, $id);
        }
        if ($id && !$entityObject) {
            throw $this->createNotFoundException(
                sprintf(
                    '%s not found for id "%s"',
                    $entityConfig->name(),
                    $id
                )
            );
        }
        try {
            $callableAction = $entityConfig->getAction($action);
        } catch (\Exception $e) {
            throw $this->createNotFoundException(
                sprintf(
                    'Action "%s" for entity "%s" not found, did you registered it in the config?',
                    $action,
                    $entity
                )
            );
        }

        return $callableAction->execute($entityObject, $entityConfig, $request);
    }
public function customAction ( $ entity , $ action , $ id = null , Request $ request ) { $ entityConfig = $ this -> get ( 'lin3s_admin.configuration.factory.entity' ) -> createFor ( $ entity ) ; $ entityObject = null ; $ repository = $ this -> get ( $ entityConfig -> repositoryServiceId ( ) ) ; $ entityConfig -> loadRepository ( $ repository ) ; if ( $ id ) { $ entityObject = $ repository -> find ( $ entityConfig , $ id ) ; } if ( $ id && ! $ entityObject ) { throw $ this -> createNotFoundException ( sprintf ( '%s not found for id "%s"' , $ entityConfig -> name ( ) , $ id ) ) ; } try { $ callableAction = $ entityConfig -> getAction ( $ action ) ; } catch ( \ Exception $ e ) { throw $ this -> createNotFoundException ( sprintf ( 'Action "%s" for entity "%s" not found, did you registered it in the config?' , $ action , $ entity ) ) ; } return $ callableAction -> execute ( $ entityObject , $ entityConfig , $ request ) ; }
Custom action.

@param string  $entity  The entity name
@param string  $action  The action name
@param string  $id      The id of the object to be edited
@param Request $request The request

@return \Symfony\Component\HttpFoundation\Response
Custom action .