當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OptionsResolverInterface::setDefault方法代碼示例

本文整理匯總了PHP中Symfony\Component\OptionsResolver\OptionsResolverInterface::setDefault方法的典型用法代碼示例。如果您正苦於以下問題:PHP OptionsResolverInterface::setDefault方法的具體用法?PHP OptionsResolverInterface::setDefault怎麽用?PHP OptionsResolverInterface::setDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\OptionsResolver\OptionsResolverInterface的用法示例。


在下文中一共展示了OptionsResolverInterface::setDefault方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     if ($this->autoGenerate) {
         $resolver->setDefault('label_add', true);
         $resolver->setDefault('label_delete', true);
     }
 }
開發者ID:ThatCheck,項目名稱:ElaoFormTranslationBundle,代碼行數:10,代碼來源:CollectionTypeExtension.php

示例2: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefined('entityName');
     $resolver->setRequired('entityName');
     $resolver->setAllowedTypes('entityName', 'string');
     $resolver->setDefault('invalid_message', function (Options $options) {
         return 'This value is not valid.  Unable to find ' . $options['entityName'] . ' in the database.';
     });
 }
開發者ID:stopfstedt,項目名稱:TdnPilotBundle,代碼行數:9,代碼來源:SingleRelatedType.php

示例3: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $dateNormalizer = function (Options $options, $value) {
         if (is_string($value)) {
             return new DateTime($value);
         } elseif (is_numeric($value)) {
             return DateTime::createFromFormat("U", $value);
         }
         return $value;
     };
     $resolver->setDefault("end", function (Options $options) {
         return new Datetime();
     })->setRequired(array("start", "end"))->setAllowedTypes("start", array("int", "string", "DateTime"))->setAllowedTypes("end", array("int", "string", "DateTime"))->setNormalizer("start", $dateNormalizer)->setNormalizer("end", $dateNormalizer);
 }
開發者ID:upenn-dag,項目名稱:patient-repository,代碼行數:17,代碼來源:DateBetweenFilter.php

示例4: setDefaultOptions

 /**
  * {@inheritDoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $options)
 {
     $options->setDefault('compound', false);
 }
開發者ID:kriswillis,項目名稱:sulu,代碼行數:7,代碼來源:DocumentObjectType.php

示例5: setDefaultOptions

 /**
  * @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver
  *
  * @return void
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     if ($this->getDataClass() instanceof TransferInterface && !$this->getDataClass() instanceof NullFormTransfer) {
         $resolver->setDefault('data_class', get_class($this->getDataClass()));
     }
 }
開發者ID:spryker,項目名稱:Gui,代碼行數:11,代碼來源:AbstractForm.php

示例6: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefault(array('attr' => array('class' => 'ckeditor')));
 }
開發者ID:nassafou,項目名稱:blog,代碼行數:4,代碼來源:CkeditorType.php

示例7: setDefaultOptions

 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefault('data_class', 'DP\\Core\\CoreBundle\\Settings\\Settings');
 }
開發者ID:Onneil,項目名稱:dedipanel,代碼行數:4,代碼來源:SettingsType.php


注:本文中的Symfony\Component\OptionsResolver\OptionsResolverInterface::setDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。