本文整理匯總了PHP中Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition::end方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayNodeDefinition::end方法的具體用法?PHP ArrayNodeDefinition::end怎麽用?PHP ArrayNodeDefinition::end使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition
的用法示例。
在下文中一共展示了ArrayNodeDefinition::end方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addProvidersNode
protected function addProvidersNode(ArrayNodeDefinition $rootNode)
{
$rootNode->ignoreExtraKeys()->fixXmlConfig('factory', 'factories')->children();
foreach ($this->providers as $provider) {
$factory = isset($this->factories[$provider]) ? $this->factories[$provider] : null;
if ($factory === null) {
throw new \LogicException(sprintf('No factory found for the provider "%s"', $provider));
}
$factoryNode = $rootNode->children()->arrayNode($provider)->isRequired();
$factory->addConfiguration($factoryNode);
}
$rootNode->end();
return $rootNode;
}
示例2: buildEntitiesPropertiesNode
private function buildEntitiesPropertiesNode()
{
$entitiesPropertiesNode = new ArrayNodeDefinition('properties');
$prototype = $entitiesPropertiesNode->info('List of properties of entity')->prototype('array');
foreach ($this->treeConfigurators as $configurator) {
foreach ((array) $configurator->appendEntitiesPropertiesNode() as $node) {
$prototype->append($node);
}
}
$prototype->children()->scalarNode('type')->info('type of data, standard type of other entity name')->example('DateTime')->cannotBeEmpty()->beforeNormalization()->always(function ($v) {
return strtolower($v);
})->end()->validate()->ifTrue(function ($v) {
return !$this->typeFactory->isValidType($v);
})->thenInvalid('Invalid Type %s')->end()->end()->scalarNode('cardinality')->info('type of cardinality OneToMany, ManyToMany')->example('(0..1)')->cannotBeEmpty()->end()->scalarNode('accessorPrefix')->info('Prefix used has accessor method : prefixPropertieName')->example('is, has, get')->defaultValue('get')->end()->scalarNode('enum')->info('Name of target enum')->cannotBeEmpty()->end()->scalarNode('entity')->info('name of target entity')->example('DateTime')->cannotBeEmpty()->end()->scalarNode('inverse')->info('define oposite property in cas of relation')->example('MyEntity::propertieName')->cannotBeEmpty()->end()->booleanNode('nullable')->info('Is this propertie is nullable?')->defaultFalse()->end()->booleanNode('primary')->info('Is this propertie is primary key ?')->defaultFalse()->end()->booleanNode('autoincrement')->info('Is this propertie is auto incremented ?')->defaultFalse()->end()->booleanNode('unique')->info('Is this propertie is unique?')->defaultFalse()->end()->variableNode('default')->info('Default value of propertie')->end()->integerNode('length')->info('Max length for string type')->min(0)->end()->integerNode('precision')->info('Number of decimal for float type')->min(1)->max(15)->end();
$entitiesPropertiesNode->end();
return $entitiesPropertiesNode;
}
示例3: configure
/**
* {@inheritdoc}
*/
public function configure(ArrayNodeDefinition $builder)
{
$builder->end();
}