canBeUnset() public method

Sets whether the node can be unset.
public canBeUnset ( boolean $allow = true ) : ArrayNodeDefinition
$allow boolean
return ArrayNodeDefinition
コード例 #1
0
ファイル: Configuration.php プロジェクト: remyma/Sylius
 /**
  * @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);
 }
コード例 #2
0
 /**
  * @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([]);
 }
コード例 #3
0
ファイル: Configuration.php プロジェクト: renegare/UserBundle
 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();
 }
コード例 #4
0
 /**
  * @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;
 }