本文整理汇总了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);
}
示例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([]);
}
示例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();
}
示例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;
}