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


PHP ArrayNodeDefinition::canBeUnset方法代碼示例

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


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

示例1: buildAttributesNode

 /**
  * @param ArrayNodeDefinition $node
  */
 private function buildAttributesNode(ArrayNodeDefinition $node)
 {
     $attributesNodeBuilder = $node->canBeUnset()->children();
     $attributesNodeBuilder->integerNode('priority')->defaultValue(0);
     /** @var ArrayNodeDefinition $optionsNode */
     $optionsNode = $attributesNodeBuilder->arrayNode('options');
     $optionsNode->addDefaultChildrenIfNoneSet();
     $optionsNode->beforeNormalization()->always(function ($value) {
         return [$value];
     });
     $optionsNode->prototype('array')->ignoreExtraKeys(false);
 }
開發者ID:remyma,項目名稱:Sylius,代碼行數:15,代碼來源:Configuration.php

示例2: buildAttributesNode

 /**
  * @param ArrayNodeDefinition $node
  */
 private function buildAttributesNode(ArrayNodeDefinition $node)
 {
     $attributesNodeBuilder = $node->canBeUnset()->children();
     $attributesNodeBuilder->integerNode('priority')->defaultValue(0);
     /** @var ArrayNodeDefinition $optionsNode */
     $optionsNode = $attributesNodeBuilder->arrayNode('options');
     $optionsNode->addDefaultChildrenIfNoneSet();
     $optionsNode->validate()->ifTrue(function ($value) {
         return !is_array($value);
     })->thenInvalid('Options have to be an array!');
     $optionsNode->beforeNormalization()->always(function ($value) {
         return is_array($value) ? [$value] : $value;
     });
     $optionsNode->prototype('variable')->cannotBeEmpty()->defaultValue([]);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:18,代碼來源:Configuration.php

示例3: addGroupSection

 private function addGroupSection(ArrayNodeDefinition $node)
 {
     $node->canBeUnset()->children()->arrayNode('group')->children()->arrayNode('class')->isRequired()->children()->scalarNode('model')->isRequired()->cannotBeEmpty()->end()->scalarNode('controller')->defaultValue('FOS\\UserBundle\\Controller\\GroupController')->end()->end()->end()->scalarNode('form')->defaultValue('FOS\\UserBundle\\Form\\GroupFormType')->end()->scalarNode('form_handler')->defaultValue('FOS\\UserBundle\\Form\\GroupFormHandler')->end()->scalarNode('form_name')->defaultValue('fos_user_group_form')->cannotBeEmpty()->end()->arrayNode('form_validation_groups')->addDefaultsIfNotSet()->prototype('scalar')->end()->defaultValue(array('Registration'))->end()->end()->end()->end();
 }
開發者ID:renegare,項目名稱:UserBundle,代碼行數:4,代碼來源:Configuration.php

示例4: getChainsNode

 /**
  * @return ArrayNodeDefinition
  */
 protected function getChainsNode()
 {
     $node = new ArrayNodeDefinition('chains');
     $node->canBeUnset(true)->useAttributeAsKey('chain_id')->prototype('array')->children()->append($this->getCellCollectionNode())->append($this->getChainSearcherNode())->append($this->getTransformersNode())->append($this->getCellsNode())->end();
     return $node;
 }
開發者ID:krzysztof-gzocha,項目名稱:searcher-bundle,代碼行數:9,代碼來源:Configuration.php


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