/**
  * @param array $options
  *
  * @throws ConfigurationException
  *
  * @return Actions
  */
 protected function getActions(array $options)
 {
     if (null === $options['actions']) {
         throw ConfigurationException::undefinedOption('actions');
     }
     return $options['actions'];
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function createGrid(Collection $collection, array $options = array())
 {
     $extensions = $this->getExtensions();
     $grid = new Grid();
     // options resolution
     $resolver = new OptionsResolver();
     foreach ($extensions as $extension) {
         $extension->configure($resolver);
     }
     $options = $resolver->resolve($options);
     // schema building
     $schema = null;
     $entity = $collection->getPeek();
     foreach ($extensions as $extension) {
         $schema = $extension->guessSchema($entity, $options);
         if (null !== $schema) {
             break;
         }
     }
     if (null === $schema) {
         throw ConfigurationException::schemaNotFound(array_keys($this->extensions));
     }
     $schema->bind($this, $grid);
     foreach ($extensions as $extension) {
         $extension->buildSchema($schema, $collection, $options);
     }
     // grid building
     foreach ($extensions as $extension) {
         $extension->buildGrid($grid, $schema, $collection, $options);
     }
     foreach ($extensions as $extension) {
         $extension->visit($grid, $options);
     }
     return $grid;
 }