コード例 #1
0
 protected function configure()
 {
     $this->addOption('choices', Locale::getDisplayCountries(\Locale::getDefault()));
     parent::configure();
 }
コード例 #2
0
ファイル: LanguageField.php プロジェクト: rosstuck/Pok
 /**
  * @inheritDoc
  */
 protected function configure()
 {
     $this->addOption('choices', Locale::getDisplayLanguages($this->locale));
     parent::configure();
 }
コード例 #3
0
ファイル: EntityChoiceField.php プロジェクト: rooster/symfony
 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     $this->addRequiredOption('em');
     $this->addRequiredOption('class');
     $this->addOption('property');
     $this->addOption('query_builder');
     // Override option - it is not required for this subclass
     $this->addOption('choices', array());
     parent::configure();
     // The entities can be passed directly in the "choices" option.
     // In this case, initializing the entity cache is a cheap operation
     // so do it now!
     if (is_array($this->getOption('choices')) && count($this->getOption('choices')) > 0) {
         $this->initializeChoices();
     }
     // If a query builder was passed, it must be a closure or QueryBuilder
     // instance
     if ($qb = $this->getOption('query_builder')) {
         if (!($qb instanceof QueryBuilder || $qb instanceof \Closure)) {
             throw new InvalidOptionsException('The option "query_builder" most contain a closure or a QueryBuilder instance', array('query_builder'));
         }
     }
 }