Esempio n. 1
0
 /**
  * @return Person_Model_Person
  */
 public function getPerson()
 {
     if (is_null($this->person) || is_null($this->person->getId())) {
         $pd = new Persons_Domain_Person();
         $this->person = $pd->getById($this->person_id);
     }
     if (is_null($this->person)) {
         $this->person = new Persons_Model_Person();
     }
     return $this->person;
 }
Esempio n. 2
0
 /**
  *
  * @param Persons_Model_Person $person
  * @return integer Person Id
  * @throws Exception
  * @throws Agana_Exception 
  */
 public function createImageRelation($person = null)
 {
     if ($person != null && $person->getMedia() != null) {
         try {
             $data = array('person_id' => $person->getId(), 'media_id' => $person->getMedia()->getId());
             $res = $this->getDefaultAdapter()->insert('person_media', $data);
             return $res;
         } catch (Exception $e) {
             throw $e;
         }
     } else {
         throw new Agana_Exception('Cannont persist a null object');
     }
 }