src/CoreBundle/EventListener/DcGeneral/Table/SearchablePages/FilterOptionListener.php
public function handle(GetPropertyOptionsEvent $event)
    {
        if (!$this->wantToHandle($event) || ($event->getPropertyName() !== 'filter')) {
            return;
        }
        $model = $event->getModel();
        $pid   = $model->getProperty('pid');
        if (empty($pid)) {
            return;
        }
        $filters = $this->connection
            ->createQueryBuilder()
            ->select('id', 'name')
            ->from('tl_metamodel_filter')
            ->where('pid=:id')
            ->setParameter('id', $model->getProperty('pid'))
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);

        $options = [];
        foreach ($filters as $filter) {
            $options[$filter['id']] = $filter['name'];
        }

        $event->setOptions($options);
    }
public function handle(GetPropertyOptionsEvent $event)
    {
        if (!$this->wantToHandle($event) || ($event->getPropertyName() !== 'filter')) {
            return;
        }
        $model = $event->getModel();
        $pid   = $model->getProperty('pid');
        if (empty($pid)) {
            return;
        }
        $filters = $this->connection
            ->createQueryBuilder()
            ->select('id', 'name')
            ->from('tl_metamodel_filter')
            ->where('pid=:id')
            ->setParameter('id', $model->getProperty('pid'))
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);

        $options = [];
        foreach ($filters as $filter) {
            $options[$filter['id']] = $filter['name'];
        }

        $event->setOptions($options);
    }
public function handle ( GetPropertyOptionsEvent $ event ) { if ( ! $ this -> wantToHandle ( $ event ) || ( $ event -> getPropertyName ( ) !== 'filter' ) ) { return ; } $ model = $ event -> getModel ( ) ; $ pid = $ model -> getProperty ( 'pid' ) ; if ( empty ( $ pid ) ) { return ; } $ filters = $ this -> connection -> createQueryBuilder ( ) -> select ( 'id' , 'name' ) -> from ( 'tl_metamodel_filter' ) -> where ( 'pid=:id' ) -> setParameter ( 'id' , $ model -> getProperty ( 'pid' ) ) -> execute ( ) -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; $ options = [ ] ; foreach ( $ filters as $ filter ) { $ options [ $ filter [ 'id' ] ] = $ filter [ 'name' ] ; } $ event -> setOptions ( $ options ) ; }
Retrieve the options for the attributes.

@param GetPropertyOptionsEvent $event The event.

@return void
Retrieve the options for the attributes .