Пример #1
0
 /**
  * @param IObject $object
  * @return IObject
  */
 public function insert(IObject $object)
 {
     $calendarId = $this->calendar->getId();
     //TODO - (maybe) check if uri exists already
     $sql = 'INSERT INTO `' . $this->getTableName() . '` ';
     $sql .= '(`calendarid`,`uri`,`type`,`etag`,';
     $sql .= '`startdate`,`enddate`,`repeating`,`summary`, `calendardata`, `lastmodified`) ';
     $sql .= 'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
     $stmt = $this->execute($sql, [$calendarId, $object->getUri(), $object->getType(), $object->getEtag(true), $this->getUTC($object->getStartDate()), $this->getUTC($object->getEndDate()), $object->getRepeating(), $object->getSummary(), $object->getCalendarData(), $this->getUTC($object->getLastModified())]);
     $object->setId((int) $this->db->lastInsertId($this->getTableName()));
     $stmt->closeCursor();
     return $object;
 }