Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5bedf13

Browse filesBrowse files
committed
[FrameworkBundle] Expose configuration of PropertyAccess
1 parent 2293556 commit 5bedf13
Copy full SHA for 5bedf13

File tree

Expand file treeCollapse file tree

6 files changed

+43
-2
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+43
-2
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* Added `Controller::isCsrfTokenValid` helper
8+
* Added configuration for the PropertyAccess component
89

910
2.5.0
1011
-----

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function getConfigTreeBuilder()
9292
$this->addValidationSection($rootNode);
9393
$this->addAnnotationsSection($rootNode);
9494
$this->addSerializerSection($rootNode);
95+
$this->addPropertyAccessSection($rootNode);
9596

9697
return $treeBuilder;
9798
}
@@ -524,4 +525,20 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode)
524525
->end()
525526
;
526527
}
528+
529+
private function addPropertyAccessSection(ArrayNodeDefinition $rootNode)
530+
{
531+
$rootNode
532+
->children()
533+
->arrayNode('property_access')
534+
->addDefaultsIfNotSet()
535+
->info('Property access configuration')
536+
->children()
537+
->booleanNode('magic_call')->defaultFalse()->end()
538+
->booleanNode('throw_exception_on_invalid_index')->defaultFalse()->end()
539+
->end()
540+
->end()
541+
->end()
542+
;
543+
}
527544
}

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ public function load(array $configs, ContainerBuilder $container)
133133

134134
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
135135

136+
$this->registerPropertyAccessConfiguration($config['property_access'], $container);
137+
136138
if (isset($config['serializer']) && $config['serializer']['enabled']) {
137139
$loader->load('serializer.xml');
138140
}
@@ -818,6 +820,15 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
818820
}
819821
}
820822

823+
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container)
824+
{
825+
$container
826+
->getDefinition('property_accessor')
827+
->replaceArgument(0, $config['magic_call'])
828+
->replaceArgument(1, $config['throw_exception_on_invalid_index'])
829+
;
830+
}
831+
821832
/**
822833
* Loads the security configuration.
823834
*

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
</parameters>
1010

1111
<services>
12-
<service id="property_accessor" class="%property_accessor.class%" />
12+
<service id="property_accessor" class="%property_accessor.class%" >
13+
<argument /> <!-- magicCall, set by the extension -->
14+
<argument /> <!-- throwExceptionOnInvalidIndex, set by the extension -->
15+
</service>
1316
</services>
1417
</container>

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,9 @@
177177
<xsd:attribute name="debug" type="xsd:string" />
178178
<xsd:attribute name="file-cache-dir" type="xsd:string" />
179179
</xsd:complexType>
180+
181+
<xsd:element name="property-accessor" type="property_accessor" minOccurs="0" maxOccurs="1" />
182+
<xsd:attribute name="magic-call" type="xsd:boolean" />
183+
<xsd:attribute name="throw-exception-on-invalid-index" type="xsd:boolean" />
184+
</xsd:complexType>
180185
</xsd:schema>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ protected static function getBundleDefaultConfig()
139139
),
140140
'serializer' => array(
141141
'enabled' => false
142-
)
142+
),
143+
'property_access' => array(
144+
'magic_call' => false,
145+
'throw_exception_on_invalid_index' => false,
146+
),
143147
);
144148
}
145149
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.