コード例 #1
0
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     if ($this->pageId) {
         $queryBuilder = $this->getClosureByPageId($this->pageId);
     } else {
         $queryBuilder = $this->getClosureByLocale($this->locale);
     }
     $resolver->setDefaults(array('query_builder' => $queryBuilder));
 }
コード例 #2
0
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     $registry = $this->registry;
     $choiceList = function (Options $options) use($registry) {
         if ($options['em'] instanceof \Doctrine\Common\Persistence\ObjectManager) {
             $manager = $options['em'];
         } else {
             $manager = $registry->getManager($options['em']);
         }
         return new MenuChoiceList($manager, $options['class'], $options['property'], $options['loader'], $options['choices'], $options['group_by']);
     };
     $resolver->replaceDefaults(array('choice_list' => $choiceList));
 }
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     $resolver->replaceDefaults(array('multiple' => true));
 }