Skip to content

Instantly share code, notes, and snippets.

@ssmusoke
Created March 29, 2012 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssmusoke/2240836 to your computer and use it in GitHub Desktop.
Save ssmusoke/2240836 to your computer and use it in GitHub Desktop.
Family - Person not loading
<?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