Created
March 29, 2012 17:54
-
-
Save ssmusoke/2240836 to your computer and use it in GitHub Desktop.
Family - Person not loading
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
<?php | |
/* File - Family.php */ | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Family relationship | |
* | |
* @ORM\Entity | |
* @ORM\Table(name="family") | |
* | |
*/ | |
class Family extends BaseRecord { | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue | |
*/ | |
protected $id; | |
/** | |
* The children | |
* | |
* @ORM\OnetoMany(targetEntity="Person", mappedBy="family") | |
* @ORM\JoinColumn(name="id", referencedColumnName="familyid") | |
*/ | |
protected $children; | |
/* (non-PHPdoc) | |
* @see BaseRecord::init() | |
*/ | |
public function init() | |
{ | |
$this->children = new ArrayCollection(); | |
} | |
} | |
/* File - Person.php */ | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Profile for a person who will be included within a family tree | |
* | |
* @ORM\Entity | |
* @ORM\Table(name="person") | |
* | |
*/ | |
class Person { | |
/** | |
* @ORM\ManyToOne(targetEntity="Family", inversedBy="children", cascade={"persist", "remove"}) | |
* @ORM\JoinColumn(name="familyid", referencedColumnName="id") | |
**/ | |
protected $family; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment