Skip to content

Commit

Permalink
Avoid compiling some classes (#699)
Browse files Browse the repository at this point in the history
When using SiteRequestFactory in the front controller,
there might be a cache generation problem:
SiteRequest and SiteRequestInterface are loaded,
and when the cache generated in CLI,
which may contain the very same classes is loaded,
leading to a conflict.
  • Loading branch information
mremi authored and OskarStark committed Aug 1, 2016
1 parent 007db7e commit 38085c4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
2 changes: 0 additions & 2 deletions DependencyInjection/SonataPageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,7 @@ public function configureClassesToCompile()
'Sonata\\PageBundle\\Page\\Service\\PageServiceInterface',
'Sonata\\PageBundle\\Page\\TemplateManager',
'Sonata\\PageBundle\\Page\\TemplateManagerInterface',
'Sonata\\PageBundle\\Request\\SiteRequest',
'Sonata\\PageBundle\\Request\\SiteRequestContext',
'Sonata\\PageBundle\\Request\\SiteRequestInterface',
'Sonata\\PageBundle\\Route\\CmsPageRouter',
'Sonata\\PageBundle\\Site\\BaseSiteSelector',
'Sonata\\PageBundle\\Site\\HostPathSiteSelector',
Expand Down
34 changes: 34 additions & 0 deletions Tests/DependencyInjection/SonataPageExtensionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Sonata\PageBundle\Tests\DependencyInjection;

use Sonata\PageBundle\DependencyInjection\SonataPageExtension;

/**
* Tests the SonataPageExtension.
*
* @author Rémi Marseille <[email protected]>
*/
class SonataPageExtensionTest extends \PHPUnit_Framework_TestCase
{
/**
* Tests the configureClassesToCompile method.
*/
public function testConfigureClassesToCompile()
{
$extension = new SonataPageExtension();
$extension->configureClassesToCompile();

$this->assertNotContains('Sonata\\PageBundle\\Request\\SiteRequest', $extension->getClassesToCompile());
$this->assertNotContains('Sonata\\PageBundle\\Request\\SiteRequestInterface', $extension->getClassesToCompile());
}
}

0 comments on commit 38085c4

Please sign in to comment.