/** * @expectedException \LogicException */ public function testOverwritePersonDifferentIdThrowsException() { $donor = new Donor(); $donor->setId(1); $donor->setFirstName('Test'); $this->phoneNumber->setPerson($donor); $this->assertEquals($donor, $this->phoneNumber->getPerson()); $secondDonor = new Donor(); $secondDonor->setId(2); $this->phoneNumber->setPerson($secondDonor); }
/** * @param PhoneNumber $phoneNumber * @return Person */ public function addPhoneNumber(PhoneNumber $phoneNumber) { $phoneNumber->setPerson($this); $this->phoneNumbers->add($phoneNumber); return $this; }