Merge branch 'DDC-1512'
This commit is contained in:
commit
f2467dd30e
@ -521,6 +521,12 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
|||||||
$this->initialize();
|
$this->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for namespace alias
|
||||||
|
if (strpos($class, ':') !== false) {
|
||||||
|
list($namespaceAlias, $simpleClassName) = explode(':', $class);
|
||||||
|
$class = $this->em->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->driver->isTransient($class);
|
return $this->driver->isTransient($class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ use Doctrine\Tests\Mocks\ConnectionMock;
|
|||||||
use Doctrine\Tests\Mocks\DriverMock;
|
use Doctrine\Tests\Mocks\DriverMock;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Doctrine\Common\EventManager;
|
use Doctrine\Common\EventManager;
|
||||||
|
use Doctrine\ORM\Mapping\ClassMetadataFactory;
|
||||||
|
|
||||||
require_once __DIR__ . '/../../TestInit.php';
|
require_once __DIR__ . '/../../TestInit.php';
|
||||||
|
|
||||||
@ -81,6 +82,51 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertFalse($h2);
|
$this->assertFalse($h2);
|
||||||
$this->assertTrue($h1);
|
$this->assertTrue($h1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1512
|
||||||
|
*/
|
||||||
|
public function testIsTransient()
|
||||||
|
{
|
||||||
|
$cmf = new ClassMetadataFactory();
|
||||||
|
$driver = $this->getMock('Doctrine\ORM\Mapping\Driver\Driver');
|
||||||
|
$driver->expects($this->at(0))
|
||||||
|
->method('isTransient')
|
||||||
|
->with($this->equalTo('Doctrine\Tests\Models\CMS\CmsUser'))
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
$driver->expects($this->at(1))
|
||||||
|
->method('isTransient')
|
||||||
|
->with($this->equalTo('Doctrine\Tests\Models\CMS\CmsArticle'))
|
||||||
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
|
$em = $this->_createEntityManager($driver);
|
||||||
|
|
||||||
|
$this->assertTrue($em->getMetadataFactory()->isTransient('Doctrine\Tests\Models\CMS\CmsUser'));
|
||||||
|
$this->assertFalse($em->getMetadataFactory()->isTransient('Doctrine\Tests\Models\CMS\CmsArticle'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DDC-1512
|
||||||
|
*/
|
||||||
|
public function testIsTransientEntityNamespace()
|
||||||
|
{
|
||||||
|
$cmf = new ClassMetadataFactory();
|
||||||
|
$driver = $this->getMock('Doctrine\ORM\Mapping\Driver\Driver');
|
||||||
|
$driver->expects($this->at(0))
|
||||||
|
->method('isTransient')
|
||||||
|
->with($this->equalTo('Doctrine\Tests\Models\CMS\CmsUser'))
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
$driver->expects($this->at(1))
|
||||||
|
->method('isTransient')
|
||||||
|
->with($this->equalTo('Doctrine\Tests\Models\CMS\CmsArticle'))
|
||||||
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
|
$em = $this->_createEntityManager($driver);
|
||||||
|
$em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS');
|
||||||
|
|
||||||
|
$this->assertTrue($em->getMetadataFactory()->isTransient('CMS:CmsUser'));
|
||||||
|
$this->assertFalse($em->getMetadataFactory()->isTransient('CMS:CmsArticle'));
|
||||||
|
}
|
||||||
|
|
||||||
protected function _createEntityManager($metadataDriver)
|
protected function _createEntityManager($metadataDriver)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user