public function initializeRequest(GenericEvent $event)
    {
        $request = null;
        if (null !== $this->requestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if (null === $request) {
            return;
        }

        $request->attributes->set('easyadmin', [
            'entity' => $entity = $event->getArgument('entity'),
            'view' => $request->query->get('action', 'list'),
            'item' => ($id = $request->query->get('id')) ? $this->findCurrentItem($entity, $id) : null,
        ]);
    }
public function initializeRequest(GenericEvent $event)
    {
        $request = null;
        if (null !== $this->requestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if (null === $request) {
            return;
        }

        $request->attributes->set('easyadmin', [
            'entity' => $entity = $event->getArgument('entity'),
            'view' => $request->query->get('action', 'list'),
            'item' => ($id = $request->query->get('id')) ? $this->findCurrentItem($entity, $id) : null,
        ]);
    }
public function initializeRequest ( GenericEvent $ event ) { $ request = null ; if ( null !== $ this -> requestStack ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; } if ( null === $ request ) { return ; } $ request -> attributes -> set ( 'easyadmin' , [ 'entity' => $ entity = $ event -> getArgument ( 'entity' ) , 'view' => $ request -> query -> get ( 'action' , 'list' ) , 'item' => ( $ id = $ request -> query -> get ( 'id' ) ) ? $ this -> findCurrentItem ( $ entity , $ id ) : null , ] ) ; }
Adds to the request some attributes with useful information, such as the
current entity and the selected item, if any.

@param GenericEvent $event
Adds to the request some attributes with useful information such as the current entity and the selected item if any .