Created
March 20, 2012 08:57
-
-
Save ssmusoke/2133023 to your computer and use it in GitHub Desktop.
Person Class with relationship column and relationship
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Doctrine\ORM\Mapping as ORM; | |
use Symfony\Component\Validator\Constraints as Assert; | |
class Person { | |
/** | |
* @ORM\Column(type="string") | |
* @Assert\NotBlank(message = "person_firstname_error") | |
*/ | |
protected $firstname = ''; | |
/** | |
* @ORM\Column(type="string") | |
* | |
* @Assert\NotBlank(message = "person_surname_error") | |
*/ | |
protected $surname = ''; | |
/** | |
* @ORM\OneToOne(targetEntity="UserAccount") | |
* @ORM\JoinColumn(name="createdby", referencedColumnName="id") | |
* @Assert\NotBlank(message = "person_createdby_error") | |
*/ | |
protected $creator; | |
/** | |
* Set the user account creating the entity | |
* @param integer $createdby | |
*/ | |
public function setCreatedBy($createdby){ | |
$this->setCreator(loadEntity('UserAccount', $createdby)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment