-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
I've tried to optimize performance of vagrant dev-environment running with Symfony 2.3.
So, i moved vendor-dir
inside virtual machine from shared folder /vagrant/vendor
into /home/vagrant/share/vendor
and created symlink from /home/vagrant/share/vendor
to /vagrant/vendor
And now on the main page http://www.local/app_dev.php/ there is an error:
Twig_Error_Loader: The "/home/vagrant/app/cache/dev/../../../share/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views" directory does not exist.
(app_dev.php is inside /vagrant/web
dir and app/cache
is /vagrant/app/cache
)
Inside /vagrant/app/cache/dev/appDevDebugProjectContainer.php
file i have this function for twig.loader
service:
protected function getTwig_LoaderService()
{
$this->services['twig.loader'] = $instance = new \Symfony\Bundle\TwigBundle\Loader\FilesystemLoader($this->get('templating.locator'), $this->get('templating.name_parser'));
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views', 'Framework');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/views', 'Security');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views', 'Twig');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/Resources/views', 'Swiftmailer');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views', 'Doctrine');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/apnet/layout-bundle/src/Apnet/LayoutBundle/Resources/views', 'ApnetLayout');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views', 'WebProfiler');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/views', 'SensioDistribution');
$instance->addPath(__DIR__.'/../../Resources/views');
$instance->addPath('/home'.__DIR__.'/../../../share/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form');
return $instance;
}
So, i think that i've found a bug in Symfony\Component\HttpKernel\Kernel::removeAbsolutePathsFromContainer
, it came from issue #10894
I think, that there is something wrong with regular expression "{'([^']*)(".preg_quote($rootDir)."[^']*)'}"
, but i do not know how to fix it =(
But i've changes fixtures for testRemoveAbsolutePathsFromContainer
in Symfony\Component\HttpKernel\Tests\KernelTest
in https://github.com/covex-nn/symfony/commit/ea654f18fa3ef160e56e95bf88edab3ad78aff80
Here is phpunit output
vagrant@www:/vagrant/symfony$ phpunit src/Symfony/Component/HttpKernel/Tests/KernelTest.php
PHPUnit 4.1.0 by Sebastian Bergmann.
Configuration read from /vagrant/symfony/phpunit.xml.dist
...........................................F.
Time: 602 ms, Memory: 20.50Mb
There was 1 failure:
1) Symfony\Component\HttpKernel\Tests\KernelTest::testRemoveAbsolutePathsFromContainer
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
'/some/where/else/foo'
-'/some/ROOT_DIR/ROOT_DIR/foo'
+'/some//vagrant/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/DumpedContainers/'.__DIR__.'/../../../foo'
'file:'.__DIR__.'/profiler'
'
/vagrant/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php:838
FAILURES!
Tests: 45, Assertions: 93, Failures: 1.