[2.0] DDC-62 - Fixed bug with proxy class generation of non-namespaced entities
This commit is contained in:
parent
a05bd5e20c
commit
932855317f
@ -135,9 +135,16 @@ class ProxyFactory
|
||||
'<methods>', '<sleepImpl>',
|
||||
'<constructorInvocation>'
|
||||
);
|
||||
|
||||
if(substr($class->name, 0, 1) == "\\") {
|
||||
$className = substr($class->name, 1);
|
||||
} else {
|
||||
$className = $class->name;
|
||||
}
|
||||
|
||||
$replacements = array(
|
||||
$this->_proxyNamespace,
|
||||
$proxyClassName, $class->name,
|
||||
$proxyClassName, $className,
|
||||
$methods, $sleepImpl,
|
||||
$constructorInv
|
||||
);
|
||||
|
@ -23,6 +23,10 @@ class ProxyClassGeneratorTest extends \Doctrine\Tests\OrmTestCase
|
||||
private $_connectionMock;
|
||||
private $_uowMock;
|
||||
private $_emMock;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\ORM\Proxy\ProxyFactory
|
||||
*/
|
||||
private $_proxyFactory;
|
||||
|
||||
protected function setUp()
|
||||
@ -103,10 +107,22 @@ class ProxyClassGeneratorTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertNotEquals($referenceProxyClass, $associationProxyClass);
|
||||
}
|
||||
|
||||
protected function _getAssociationMock()
|
||||
public function testNonNamespacedProxyGeneration()
|
||||
{
|
||||
$assoc = $this->getMock('Doctrine\ORM\Mapping\AssociationMapping', array('load'), array(), '', false, false, false);
|
||||
return $assoc;
|
||||
require_once dirname(__FILE__)."/fixtures/NonNamespacedProxies.php";
|
||||
|
||||
$className = "\DoctrineOrmTestEntity";
|
||||
$proxyName = "DoctrineOrmTestEntityProxy";
|
||||
$classMetadata = new \Doctrine\ORM\Mapping\ClassMetadata($className);
|
||||
$classMetadata->mapField(array('fieldName' => 'id', 'type' => 'integer'));
|
||||
$classMetadata->setIdentifier(array('id'));
|
||||
|
||||
$this->_proxyFactory->generateProxyClasses(array($classMetadata));
|
||||
|
||||
$classCode = file_get_contents(dirname(__FILE__)."/generated/".$proxyName.".php");
|
||||
|
||||
$this->assertNotContains("class DoctrineOrmTestEntityProxy extends \\\\DoctrineOrmTestEntity", $classCode);
|
||||
$this->assertContains("class DoctrineOrmTestEntityProxy extends \\DoctrineOrmTestEntity", $classCode);
|
||||
}
|
||||
|
||||
protected function _getMockPersister()
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @entity
|
||||
*/
|
||||
class DoctrineOrmTestEntity
|
||||
{
|
||||
/**
|
||||
* @column(type="integer")
|
||||
* @id
|
||||
*/
|
||||
public $id;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user