[DDC-386][DDC-675] Fixed.
This commit is contained in:
parent
dcebc241b4
commit
0424d87099
@ -25,6 +25,7 @@ use Closure, Exception,
|
||||
Doctrine\DBAL\LockMode,
|
||||
Doctrine\ORM\Mapping\ClassMetadata,
|
||||
Doctrine\ORM\Mapping\ClassMetadataFactory,
|
||||
Doctrine\ORM\Query\ResultSetMapping,
|
||||
Doctrine\ORM\Proxy\ProxyFactory;
|
||||
|
||||
/**
|
||||
@ -225,7 +226,14 @@ class EntityManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the metadata for a class.
|
||||
* Returns the ORM metadata descriptor for a class.
|
||||
*
|
||||
* The class name must be the fully-qualified class name without a leading backslash
|
||||
* (as it is returned by get_class($obj)) or an aliased class name.
|
||||
*
|
||||
* Examples:
|
||||
* MyProject\Domain\User
|
||||
* sales:PriceRequest
|
||||
*
|
||||
* @return Doctrine\ORM\Mapping\ClassMetadata
|
||||
* @internal Performance-sensitive method.
|
||||
@ -268,7 +276,7 @@ class EntityManager
|
||||
* @param ResultSetMapping $rsm The ResultSetMapping to use.
|
||||
* @return NativeQuery
|
||||
*/
|
||||
public function createNativeQuery($sql, \Doctrine\ORM\Query\ResultSetMapping $rsm)
|
||||
public function createNativeQuery($sql, ResultSetMapping $rsm)
|
||||
{
|
||||
$query = new NativeQuery($this);
|
||||
$query->setSql($sql);
|
||||
@ -338,7 +346,7 @@ class EntityManager
|
||||
*/
|
||||
public function getReference($entityName, $identifier)
|
||||
{
|
||||
$class = $this->metadataFactory->getMetadataFor($entityName);
|
||||
$class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\'));
|
||||
|
||||
// Check identity map first, if its already in there just return it.
|
||||
if ($entity = $this->unitOfWork->tryGetById($identifier, $class->rootEntityName)) {
|
||||
@ -374,7 +382,7 @@ class EntityManager
|
||||
*/
|
||||
public function getPartialReference($entityName, $identifier)
|
||||
{
|
||||
$class = $this->metadataFactory->getMetadataFor($entityName);
|
||||
$class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\'));
|
||||
|
||||
// Check identity map first, if its already in there just return it.
|
||||
if ($entity = $this->unitOfWork->tryGetById($identifier, $class->rootEntityName)) {
|
||||
@ -534,11 +542,12 @@ class EntityManager
|
||||
/**
|
||||
* Gets the repository for an entity class.
|
||||
*
|
||||
* @param string $entityName The name of the Entity.
|
||||
* @return EntityRepository The repository.
|
||||
* @param string $entityName The name of the entity.
|
||||
* @return EntityRepository The repository class.
|
||||
*/
|
||||
public function getRepository($entityName)
|
||||
{
|
||||
$entityName = ltrim($entityName, '\\');
|
||||
if (isset($this->repositories[$entityName])) {
|
||||
return $this->repositories[$entityName];
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class Lexer extends \Doctrine\Common\Lexer
|
||||
protected function getCatchablePatterns()
|
||||
{
|
||||
return array(
|
||||
'[a-z_][a-z0-9_\:\\\]*[a-z0-9_]{1}',
|
||||
'[a-z_\\\][a-z0-9_\:\\\]*[a-z0-9_]{1}',
|
||||
'(?:[0-9]+(?:[\.][0-9]+)*)(?:e[+-]?[0-9]+)?',
|
||||
"'(?:[^']|'')*'",
|
||||
'\?[1-9][0-9]*|:[a-z][a-z0-9_]+'
|
||||
|
@ -765,7 +765,7 @@ class Parser
|
||||
{
|
||||
$this->match(Lexer::T_IDENTIFIER);
|
||||
|
||||
$schemaName = $this->_lexer->token['value'];
|
||||
$schemaName = ltrim($this->_lexer->token['value'], '\\');
|
||||
|
||||
if (strrpos($schemaName, ':') !== false) {
|
||||
list($namespaceAlias, $simpleClassName) = explode(':', $schemaName);
|
||||
|
@ -129,7 +129,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$user2 = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.id=?1')
|
||||
$user2 = $this->_em->createQuery('select u from \Doctrine\Tests\Models\CMS\CmsUser u where u.id=?1')
|
||||
->setParameter(1, $userId)
|
||||
->getSingleResult();
|
||||
|
||||
@ -440,7 +440,9 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$articleNew = $this->_em->find('Doctrine\Tests\Models\CMS\CmsArticle', $articleId);
|
||||
// test find() with leading backslash at the same time
|
||||
$articleNew = $this->_em->find('\Doctrine\Tests\Models\CMS\CmsArticle', $articleId);
|
||||
$this->assertTrue($this->_em->contains($articleNew));
|
||||
$this->assertEquals("Lorem ipsum dolor sunt.", $articleNew->text);
|
||||
|
||||
$this->assertNotSame($article, $articleNew);
|
||||
|
Loading…
x
Reference in New Issue
Block a user