2009-05-21 12:53:40 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Models\Company;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Description of CompanyPerson
|
|
|
|
*
|
|
|
|
* @author robo
|
2009-05-29 14:23:13 +04:00
|
|
|
* @Entity
|
|
|
|
* @Table(name="company_persons")
|
|
|
|
* @DiscriminatorValue("person")
|
2009-06-07 21:20:37 +04:00
|
|
|
* @InheritanceType("JOINED")
|
2009-05-29 14:23:13 +04:00
|
|
|
* @DiscriminatorColumn(name="discr", type="string")
|
|
|
|
* @SubClasses({"Doctrine\Tests\Models\Company\CompanyEmployee",
|
2009-05-21 12:53:40 +04:00
|
|
|
"Doctrine\Tests\Models\Company\CompanyManager"})
|
|
|
|
*/
|
|
|
|
class CompanyPerson
|
|
|
|
{
|
|
|
|
/**
|
2009-05-29 14:23:13 +04:00
|
|
|
* @Id
|
|
|
|
* @Column(type="integer")
|
2009-06-07 21:20:37 +04:00
|
|
|
* @GeneratedValue(strategy="AUTO")
|
2009-05-21 12:53:40 +04:00
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
/**
|
2009-05-29 14:23:13 +04:00
|
|
|
* @Column(type="string")
|
2009-05-21 12:53:40 +04:00
|
|
|
*/
|
|
|
|
private $name;
|
|
|
|
/**
|
2009-05-29 14:23:13 +04:00
|
|
|
* @OneToOne(targetEntity="CompanyPerson")
|
|
|
|
* @JoinColumn(name="spouse_id", referencedColumnName="id")
|
2009-05-21 12:53:40 +04:00
|
|
|
*/
|
|
|
|
private $spouse;
|
|
|
|
|
|
|
|
public function getId() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setName($name) {
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSpouse() {
|
|
|
|
return $this->spouse;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSpouse(CompanyPerson $spouse) {
|
|
|
|
if ($spouse !== $this->spouse) {
|
|
|
|
$this->spouse = $spouse;
|
|
|
|
$this->spouse->setSpouse($this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|