Ejemplo n.º 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;
 }