Beispiel #1
0
 public function getFamilyTreeBySon(Person $son)
 {
     $pM = new PersonModel($son->getId(), $son->getCompleteName());
     if (null != $son->getMother()) {
         $mother = $son->getMother();
         $motherModel = new PersonModel($mother->getId(), $mother->getCompleteName());
         $this->getFamilyTreeBySon($mother);
         $pM->addParent($motherModel);
     }
     if (null != $son->getFather()) {
         $father = $son->getFather();
         $fatherModel = new PersonModel($father->getId(), $father->getCompleteName());
         $this->getFamilyTreeBySon($father);
         $pM->addParent($fatherModel);
     }
     $this->personModels[] = $pM;
     return $this->personModels;
 }
Beispiel #2
0
 public function addChildOfFather(Person $child)
 {
     $this->childrenOfFather[] = $child;
     $child->setFather($this);
     return $this;
 }