Skip to content

Commit

Permalink
[Framework] better fix for the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 11, 2010
1 parent b64e66d commit fca137f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
9 changes: 9 additions & 0 deletions src/Symfony/Framework/ClassCollectionLoader.php
Expand Up @@ -18,11 +18,20 @@
*/
class ClassCollectionLoader
{
static protected $loaded;

/**
* @throws \InvalidArgumentException When class can't be loaded
*/
static public function load($classes, $cacheDir, $name, $autoReload)
{
// each $name can only be loaded once per PHP process
if (isset(self::$loaded[$name])) {
return;
}

self::$loaded[$name] = true;

$classes = array_unique($classes);

$cache = $cacheDir.'/'.$name.'.php';
Expand Down
19 changes: 6 additions & 13 deletions src/Symfony/Framework/Kernel.php
Expand Up @@ -36,8 +36,6 @@
*/
abstract class Kernel implements HttpKernelInterface, \Serializable
{
static protected $loaded;

protected $bundles;
protected $bundleDirs;
protected $container;
Expand Down Expand Up @@ -127,17 +125,12 @@ public function boot()
$this->container = $this->initializeContainer();

// load core classes
// can only be loaded once (for all Kernel in the same process)
if (!self::$loaded) {
self::$loaded = true;

ClassCollectionLoader::load(
$this->container->getParameter('kernel.compiled_classes'),
$this->container->getParameter('kernel.cache_dir'),
'classes',
$this->container->getParameter('kernel.debug')
);
}
ClassCollectionLoader::load(
$this->container->getParameter('kernel.compiled_classes'),
$this->container->getParameter('kernel.cache_dir'),
'classes',
$this->container->getParameter('kernel.debug')
);

foreach ($this->bundles as $bundle) {
$bundle->setContainer($this->container);
Expand Down

0 comments on commit fca137f

Please sign in to comment.