Example #1
0
 /**
  * {@inheritDoc}
  */
 public function provide()
 {
     $notTrashed = new NotTrashedCollectionFilter();
     $hasCurrent = new HasCurrentRevisionCollectionFilter();
     $chain = new FilterChain();
     $chain->attach($notTrashed);
     $chain->attach($hasCurrent);
     $container = [];
     $types = $this->options->getTypes();
     foreach ($types as $type) {
         if ($type->hasComponent('search')) {
             /* @var $component SearchOptions */
             $component = $type->getComponent('search');
             if ($component->getEnabled()) {
                 $name = $type->getName();
                 $entities = $this->entityManager->findEntitiesByTypeName($name, true);
                 $entities = $chain->filter($entities);
                 $this->addEntitiesToContainer($entities, $container);
             }
         }
     }
     return $container;
 }