Procházet zdrojové kódy

merged branch schmittjoh/doctrineAutoloadFix (PR #1501)

Commits
-------

d28cf66 changed autoloading behavior to give better error message

Discussion
----------

changed autoloading behavior to give better error message
Fabien Potencier před 14 roky
rodič
revize
89aba26e42

+ 6 - 2
src/Symfony/Bundle/DoctrineBundle/DoctrineBundle.php

@@ -42,13 +42,17 @@ class DoctrineBundle extends Bundle
         if ($this->container->hasParameter('doctrine.orm.proxy_namespace')) {
             $namespace = $this->container->getParameter('doctrine.orm.proxy_namespace');
             $dir = $this->container->getParameter('doctrine.orm.proxy_dir');
+
             spl_autoload_register(function($class) use ($namespace, $dir) {
                 if (0 === strpos($class, $namespace)) {
                     $className = substr($class, strlen($namespace) +1);
                     $file = $dir.DIRECTORY_SEPARATOR.$className.'.php';
-                    if (file_exists($file)) {
-                        require $file;
+
+                    if (!file_exists($file)) {
+                        throw new \RuntimeException(sprintf('The proxy file "%s" does not exist. If you still have objects serialized in the session, you need to clear the session manually.', $file));
                     }
+
+                    require $file;
                 }
             });
         }