merged branch Spea/2.0 (PR #3590)
Commits
-------
50cb486
Fixed proxy generation in the DoctrineBundle when using Doctrine >= 2.2.0
Discussion
----------
[DoctrineBundle] Fixed proxy generation with Doctrine >= 2.2.0
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
The issue here was, that the name of the generated Proxy files have changed in Doctrine 2.2.0, thus the autoloader in the DoctrineBundle stoped working.
This PR fixes this issue by applying different string manipulations to the given class name depending on the currently used Doctrine version.
---------------------------------------------------------------------------
by fabpot at 2012-03-14T07:13:23Z
Can you squash your commits before I merge? Thanks.
---------------------------------------------------------------------------
by Spea at 2012-03-14T09:33:10Z
Should I open a new PR when squashed the commits? Because I don't know what happens when I force the remote repository to push my squashed commits.
---------------------------------------------------------------------------
by stloyd at 2012-03-14T09:48:05Z
First you should rebase (normally), then squash and push with `--force`, then GH will automaticaly update this PR (if you push into same branch on which bases this PR).
---------------------------------------------------------------------------
by Spea at 2012-03-14T10:04:30Z
Yeah I knew about the ```--force``` option. I just wasn't sure what happens when I do it. Thank you!
---------------------------------------------------------------------------
by Spea at 2012-03-14T10:14:23Z
Squashed commits.
This commit is contained in:
commit
d4057aed08
@ -15,6 +15,8 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Bundle\DoctrineBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Doctrine\ORM\Version;
|
||||
use Doctrine\Common\Util\ClassUtils;
|
||||
|
||||
/**
|
||||
* Bundle.
|
||||
@ -49,11 +51,16 @@ class DoctrineBundle extends Bundle
|
||||
$this->autoloader = function($class) use ($namespace, $dir, &$container) {
|
||||
if (0 === strpos($class, $namespace)) {
|
||||
$className = substr($class, strlen($namespace) +1);
|
||||
$file = $dir.DIRECTORY_SEPARATOR.$className.'.php';
|
||||
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', '', $className).'.php';
|
||||
|
||||
if (!file_exists($file) && $container->getParameter('kernel.debug')) {
|
||||
$originalClassName = substr($className, 0, -5);
|
||||
$registry = $container->get('doctrine');
|
||||
if (1 === Version::compare('2.2.0')) {
|
||||
$originalClassName = substr($className, 0, -5);
|
||||
} else {
|
||||
$originalClassName = ClassUtils::getRealClass($className);
|
||||
$originalClassName = str_replace('\\', '', $originalClassName);
|
||||
}
|
||||
|
||||
// Tries to auto-generate the proxy file
|
||||
foreach ($registry->getEntityManagers() as $em) {
|
||||
|
Reference in New Issue
Block a user