src/AdminBundle/Admin/Founders/SolemnEventsAdmin.php line 8

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Admin\Founders;
  3. use FoundersBundle\Model\Post as ModelPost;
  4. use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
  5. class SolemnEventsAdmin extends BasePostAdmin
  6. {
  7.     protected $baseRouteName 'adminbundle_founders_solemn_events_admin';
  8.     protected $baseRoutePattern 'founders-post-solemn-events';
  9.     public function prePersist($object): void
  10.     {
  11.         $object->setPostType(ModelPost::POST_TYPE_SOLEMN_EVENT);
  12.         parent::prePersist($object);
  13.     }
  14.     public function configureQuery($context 'list'): ProxyQueryInterface
  15.     {
  16.         $query parent::configureQuery($context);
  17.         $query->where($query->getRootAliases()[0].'.post_type = ' ModelPost::POST_TYPE_SOLEMN_EVENT);
  18.         return $query;
  19.     }
  20. }