示例#1
0
 /**
  * @param array $p_authorBiography
  * @return void
  */
 public function setBiography(array $p_biography)
 {
     if (empty($p_biography) || !isset($p_biography['language'])) {
         return false;
     }
     $biographyObj = new AuthorBiography($this->getId(), $p_biography['language']);
     if (isset($p_biography['biography']) && !empty($p_biography['biography'])) {
         $biographyObj->setProperty('biography', $p_biography['biography'], false);
     }
     if (isset($p_biography['first_name']) && !empty($p_biography['first_name'])) {
         $biographyObj->setProperty('first_name', $p_biography['first_name'], false);
     }
     if (isset($p_biography['last_name']) && !empty($p_biography['last_name'])) {
         $biographyObj->setProperty('last_name', $p_biography['last_name'], false);
     }
     if ($biographyObj->exists()) {
         $biographyObj->commit();
     } else {
         $biographyObj->create();
     }
 }