1
0
mirror of synced 2025-01-06 00:57:10 +03:00

Fixes DDC-1354.

This commit is contained in:
Guilherme Blanco 2011-09-01 03:00:53 -03:00
parent 53a153bc15
commit ecc556f687

View File

@ -774,9 +774,13 @@ class ClassMetadataInfo implements ClassMetadata
// If targetEntity is unqualified, assume it is in the same namespace as // If targetEntity is unqualified, assume it is in the same namespace as
// the sourceEntity. // the sourceEntity.
$mapping['sourceEntity'] = $this->name; $mapping['sourceEntity'] = $this->name;
if (isset($mapping['targetEntity']) && strpos($mapping['targetEntity'], '\\') === false
&& strlen($this->namespace) > 0) { if (isset($mapping['targetEntity'])) {
$mapping['targetEntity'] = $this->namespace . '\\' . $mapping['targetEntity']; if (strlen($this->namespace) > 0 && strpos($mapping['targetEntity'], '\\') === false) {
$mapping['targetEntity'] = $this->namespace . '\\' . $mapping['targetEntity'];
}
$mapping['targetEntity'] = ltrim($mapping['targetEntity'], '\\');
} }
// Complete id mapping // Complete id mapping
@ -1625,11 +1629,13 @@ class ClassMetadataInfo implements ClassMetadata
public function setDiscriminatorMap(array $map) public function setDiscriminatorMap(array $map)
{ {
foreach ($map as $value => $className) { foreach ($map as $value => $className) {
if (strpos($className, '\\') === false && strlen($this->namespace)) { if (strlen($this->namespace) > 0 && strpos($className, '\\') === false) {
$className = $this->namespace . '\\' . $className; $className = $this->namespace . '\\' . $className;
} }
$className = ltrim($className, '\\'); $className = ltrim($className, '\\');
$this->discriminatorMap[$value] = $className; $this->discriminatorMap[$value] = $className;
if ($this->name == $className) { if ($this->name == $className) {
$this->discriminatorValue = $value; $this->discriminatorValue = $value;
} else { } else {