Example #1
0
 /**
  * Update a people tag gracefully
  * also change "tag" fields in profile_tag table
  *
  * @param Profile_list $dataObject    Object's original form
  *
  * @return boolean success
  */
 function update($dataObject = false)
 {
     if (!is_object($dataObject) && !$dataObject instanceof Profile_list) {
         return parent::update($dataObject);
     }
     $result = true;
     // if original tag was different
     // check to see if the new tag already exists
     // if not, rename the tag correctly
     if ($dataObject->tag != $this->tag || $dataObject->tagger != $this->tagger) {
         $existing = Profile_list::getByTaggerAndTag($this->tagger, $this->tag);
         if (!empty($existing)) {
             // TRANS: Server exception.
             throw new ServerException(_('The tag you are trying to rename ' . 'to already exists.'));
         }
         // move the tag
         // XXX: allow OStatus plugin to send out profile tag
         $result = Profile_tag::moveTag($dataObject, $this);
     }
     return parent::update($dataObject);
 }