示例#1
0
 /**
  * Update title and description if they've changed
  * $params are kept as array to be compliant with others events,
  * but we merely need event objects
  *
  * @param array $params
  */
 public function updateDocument($params)
 {
     $item = $params['item'];
     $new_data = $params['new'];
     $update_data = array('script' => '', 'params' => array());
     $updated = false;
     if ($this->titleUpdated($new_data['title'], $item)) {
         $update_data = $this->client->buildSetterData($update_data, 'title', $new_data['title']);
         $updated = true;
     }
     if ($this->descriptionUpdated($new_data, $item)) {
         $update_data = $this->client->buildSetterData($update_data, 'description', $new_data['description']);
         $updated = true;
     }
     if ($updated) {
         $this->client->update($item->getid(), $update_data);
     }
 }