Permalink
Browse files

app.membersをリストとして記述するよう変更

  • Loading branch information...
1 parent 9894dd4 commit d9f4e70820c180996ec9b8704290f450e5893d73 @iakio committed Feb 28, 2016
@@ -81,5 +81,5 @@ nelmio_cors:
app:
members:
- 山田: {part: トランペット, joinedDate: "2010-10-01"}
- 田中: {part: バイオリン, joinedDate: "2008-04-10"}
+ - {name: 山田, part: トランペット, joinedDate: "2010-10-01"}
+ - {name: 田中, part: バイオリン, joinedDate: "2008-04-10"}
@@ -32,9 +32,9 @@ private function buildMemberCollectionDefinition(ContainerBuilder $container, $m
{
$collectionDefinition = $container->register('app.member_collection', MemberCollection::class);
- foreach ($memberList as $name => $memberInfo) {
+ foreach ($memberList as $memberInfo) {
$collectionDefinition->addMethodCall('addMember', [
- $name, $memberInfo['part'], $memberInfo['joinedDate']
+ $memberInfo['name'], $memberInfo['part'], $memberInfo['joinedDate']
]);
}
}
@@ -21,9 +21,9 @@ public function getConfigTreeBuilder()
$rootNode
->children()
->arrayNode('members')
- ->useAttributeAsKey('name')
->prototype('array')
->children()
+ ->scalarNode('name')->isRequired()->end()
->scalarNode('part')->isRequired()->end()
->scalarNode('joinedDate')->isRequired()->end()
->end()

0 comments on commit d9f4e70

Please sign in to comment.