public function isValidMother(PersonaInterface $persona, PersonaInterface $mother)
 {
     $errors = [];
     if ($mother->getGender() !== self::GENDER_FEMALE) {
         $errors[] = 'Mother must be a female';
     }
     if ($mother->hasDateOfBirth() && $persona->hasDateOfBirth() && (int) $mother->getDateOfBirth('Y') >= (int) $persona->getDateOfBirth('Y')) {
         $errors[] = 'Child must be younger than the parent';
     }
     return $this->getResult($errors);
 }
 public function isValidSpouse(PersonaInterface $persona, PersonaInterface $spouse)
 {
     $errors = [];
     if ($persona === $spouse) {
         $errors[] = "Persona can't be spouse for self";
     }
     if ($persona->getGender() === self::GENDER_UNDEFINED || $spouse->getGender() === self::GENDER_UNDEFINED) {
         $errors[] = 'Both spouses must have the gender. ';
     }
     if ($persona->getGender() === $spouse->getGender()) {
         $errors[] = 'Spouses must be of different genders. ';
     }
     if ($persona->hasDateOfBirth() && $spouse->hasDateOfDeath()) {
         if ($persona->getDateOfBirth() >= $spouse->getDateOfDeath()) {
             $errors[] = "Persona can't born after spouse death. ";
         }
     }
     if ($persona->hasDateOfDeath() && $spouse->hasDateOfBirth()) {
         if ($persona->getDateOfDeath() <= $spouse->getDateOfBirth()) {
             $errors[] = "Persona can't dead before spouse will born. ";
         }
     }
     return $this->getResult($errors);
 }
 /**
  *
  *
  * @param PersonaInterface $persona
  * @return array
  */
 protected function extractData(PersonaInterface $persona)
 {
     $data = ['gender' => $persona->getGender(), 'father_id' => $persona->hasFather() ? $persona->getFather()->getId() : null, 'mother_id' => $persona->hasMother() ? $persona->getMother()->getId() : null];
     if (!$this->notSaved($persona)) {
         $data['id'] = $persona->getId();
     }
     return $data;
 }