Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.2.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Debian Squeeze, MySQL 5
Description
after setting a one-to-one bi-directional relationship, I am hunting a bug and trying this:
\Doctrine\Common\Util\Debug::Dump($this->lord, 1);
\Doctrine\Common\Util\Debug::Dump($this, 2);
\Doctrine\Common\Util\Debug::Dump($this->lord, 1);
The first Dump() shows $this->lord as being NULL.
The third Dump() shows it as NOT being null, just like the 2nd one also shows it as having a value.
More analysis found the issue being caused by an overloaded setLord() method:
public function setLord($NewLord) {
{ $this->lord->setFief(null); // this is the line causing the issue if ($NewLord) $NewLord->setFief($this); $this->lord = $NewLord; $this->lordDays = 0; }// overwriting the setter because we also want to update the lord days counter
if ($NewLord!=$this->lord)
return $this;
}
without the marked line, everything works as expected, but of course the inverse side doesn't get updated without it.