create() 공개 메소드

Create a new object.
public create ( &$object, boolean $raw = false ) : string
$raw boolean True if the data to be stored has been provided in raw format.
리턴 string The ID of the new object or true in case the backend does not support this return value.
예제 #1
0
파일: Log.php 프로젝트: horde/horde
 /**
  * Create a new object.
  *
  * @param array   &$object The array that holds the object data.
  * @param boolean $raw     True if the data to be stored has been provided in
  *                         raw format.
  *
  * @return string The ID of the new object or true in case the backend does
  *                not support this return value.
  *
  * @throws Horde_Kolab_Storage_Exception In case an error occured while
  *                                       saving the data.
  */
 public function create(&$object, $raw = false)
 {
     $this->_logger->debug(sprintf('Creating new data object in %s.', $this->_data->getPath()));
     $result = $this->_data->create($object, $raw);
     $this->_logger->debug(sprintf('Created data object %s in %s [backend: %s].', $object['uid'], $this->_data->getPath(), $result));
     return $result;
 }
예제 #2
0
파일: Kolab.php 프로젝트: Gomez/horde
 /**
  * Saves an event in the backend.
  *
  * @param Kronolith_Event $event  The event to save.
  *
  * @return string  The event id.
  * @throws Horde_Mime_Exception
  */
 protected function _saveEvent($event, $edit)
 {
     $this->synchronize();
     $action = $edit ? array('action' => 'modify') : array('action' => 'add');
     if (!$event->uid) {
         $event->uid = $this->_data->generateUID();
         $event->id = Horde_Url::uriB64Encode($event->uid);
     }
     $object = $event->toKolab();
     if ($edit) {
         $this->_data->modify($object);
     } else {
         $this->_data->create($object);
     }
     /* Deal with tags */
     if ($edit) {
         $this->_updateTags($event);
     } else {
         $this->_addTags($event);
     }
     /* Notify about the changed event. */
     Kronolith::sendNotification($event, $edit ? 'edit' : 'add');
     /* Log the creation/modification of this item in the history log. */
     try {
         $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true);
     } catch (Exception $e) {
         Horde::log($e, 'ERR');
     }
     // refresh IMAP cache
     $this->synchronize(true);
     if (is_callable('Kolab', 'triggerFreeBusyUpdate')) {
         //Kolab::triggerFreeBusyUpdate($this->_data->parseFolder($event->calendar));
     }
     return $event->id;
 }