예제 #1
0
 /**
  * Copy associations from this tag to another
  *
  * @param   integer  $tag_id  ID of tag to copy associations to
  * @return  boolean
  */
 public function copyTo($tag_id)
 {
     if (!$tag_id) {
         $this->addError(Lang::txt('Missing tag ID.'));
         return false;
     }
     // Get all the associations to this tag
     // Loop through the associations and link them to a different tag
     if (!Object::copyTo($this->get('id'), $tag_id)) {
         $this->addError($to->getError());
         return false;
     }
     // Update new tag's counts
     $tag = self::one($tag_id);
     $tag->set('objects', $tag->objects()->total())->save();
     return true;
 }