8000 merged branch igorw/protected-fileloader (PR #5981) · symfony/symfony@d55d3b8 · GitHub
[go: up one dir, main page]

Skip to content

Commit d55d3b8

Browse files
committed
merged branch igorw/protected-fileloader (PR #5981)
This PR was merged into the 2.1 branch. Commits ------- c659e78 Make YamlFileLoader and XmlFileLoader file loading extensible Discussion ---------- Make YamlFileLoader and XmlFileLoader file loading extensible Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes License of the code: MIT Documentation PR: not needed For phpBB we want to use a non-dumped container in the dev env to prevent having to clear the cache all the time. We're creating the container twice because we need some information at compile time which must be fetched from the container. The process is as follows: Create temp container, get list of installed extensions (think bundles), create a compiler pass with the extensions list, create a new container with that compiler pass, compile it, dump it. The problem is that we need to load and parse the YAML twice which is really slow. Caching it in the YamlFileLoader should save 50-100ms per page load. By changing visibility to protected it becomes possible to extend the loader and cache file contents.
2 parents d9b291b + c659e78 commit d55d3b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private function parseDefinition($id, $service, $file)
204204
*
205205
* @throws \InvalidArgumentException When loading of XML file returns error
206206
*/
207-
private function parseFile($file)
207+
protected function parseFile($file)
208208
{
209209
$internalErrors = libxml_use_internal_errors(true);
210210
$disableEntities = libxml_disable_entity_loader(true);

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ private function parseDefinition($id, $service, $file)
233233
*
234234
* @return array The file content
235235
*/
236-
private function loadFile($file)
236+
protected function loadFile($file)
237237
{
238238
return $this->validate(Yaml::parse($file), $file);
239239
}

0 commit comments

Comments
 (0)
0