예제 #1
0
 public function __unset($key)
 {
     if (!$this->isRetrieved()) {
         $this->retrieve();
     }
     parent::__unset($key);
     if ($key === 'PHOTO') {
         Properties::cacheThumbnail($this->getBackend()->name, $this->getParent()->getId(), $this->getId(), null, $this, array('remove' => true));
     }
     $this->setSaved(false);
 }
예제 #2
0
 public function __unset($key)
 {
     if (!$this->isRetrieved()) {
         $this->retrieve();
     }
     parent::__unset($key);
     if ($key === 'PHOTO') {
         $this->cacheThumbnail(null, true);
     }
     $this->setSaved(false);
 }
 /**
  * @param $id
  * @return mixed
  */
 public function delete($id)
 {
     try {
         $query = 'SELECT COUNT(*) as `count` FROM `*PREFIX*contacts_cards` WHERE `id` = ? AND `addressbookid` = ?';
         $stmt = \OCP\DB::prepare($query);
         $result = $stmt->execute(array($id, $this->id));
         if (\OCP\DB::isError($result)) {
             \OCP\Util::writeLog('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
             return false;
         }
         if ((int) $result['count'] === 0) {
             \OCP\Util::writeLog('contacts', __METHOD__ . 'Contact with id ' . $id . 'doesn\'t belong to addressbook with id ' . $this->id, \OCP\Util::ERROR);
             return false;
         }
     } catch (\Exception $e) {
         \OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
         return false;
     }
     return VCard::delete($id);
 }