Skip to content

Commit

Permalink
Fixes DDC-1354.
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermeblanco committed Sep 1, 2011
1 parent 53a153b commit ecc556f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Expand Up @@ -774,9 +774,13 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
// If targetEntity is unqualified, assume it is in the same namespace as
// the sourceEntity.
$mapping['sourceEntity'] = $this->name;
if (isset($mapping['targetEntity']) && strpos($mapping['targetEntity'], '\\') === false
&& strlen($this->namespace) > 0) {
$mapping['targetEntity'] = $this->namespace . '\\' . $mapping['targetEntity'];

if (isset($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
Expand Down Expand Up @@ -1625,11 +1629,13 @@ public function setDiscriminatorColumn($columnDef)
public function setDiscriminatorMap(array $map)
{
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 = ltrim($className, '\\');
$this->discriminatorMap[$value] = $className;

if ($this->name == $className) {
$this->discriminatorValue = $value;
} else {
Expand Down

0 comments on commit ecc556f

Please sign in to comment.