public function delete(RecordInterface $record) { if ($record->hasFields('id')) { $con = new Condition(array('id', '=', $record->id)); $this->table->delete($con); $this->notify(RecordAbstract::DELETE, $record); return $record; } else { throw new Exception('Missing field in record'); } }
public function delete(RecordInterface $record) { if ($record->hasFields('id')) { // move all friends to uncategorized $con = new Condition(); $con->add('userId', '=', $this->user->getId()); $con->add('groupId', '=', $record->id); $this->sql->update($this->registry['table.user_friend'], array('groupId' => 0), $con); $con = new Condition(array('id', '=', $record->id)); $this->table->delete($con); $this->notify(RecordAbstract::DELETE, $record); return $record; } else { throw new Exception('Missing field in record'); } }
public function remote(RecordInterface $record) { if ($record->hasFields('mode', 'host', 'name')) { switch ($record->mode) { case 'request': case 'accept': case 'deny': $methodName = 'handle' . ucfirst($record->mode); $callback = array($this, $methodName); if (is_callable($callback)) { return call_user_func_array($callback, array($record)); } else { throw new Exception('Could not call method "' . $methodName . '"'); } break; default: throw new Exception('Invalid mode'); break; } } else { throw new Exception('Missing field in record'); } }
public function delete(RecordInterface $record) { if ($record->hasFields('id')) { $con = new Condition(array('id', '=', $record->id)); $this->table->delete($con); $this->notify(RecordAbstract::DELETE, $record); // delete assigned gadgets $handler = $this->hm->getHandler('AmunService\\Content\\Page\\Gadget', $this->user); $con = new Condition(array('pageId', '=', $record->id)); $oldGadgets = $this->hm->getTable('AmunService\\Content\\Page\\Gadget')->getCol('id', $con); foreach ($oldGadgets as $id) { $gadgetRecord = $handler->getRecord(); $gadgetRecord->id = $id; $handler->delete($gadgetRecord); } return $record; } else { throw new Exception('Missing field in record'); } }
public function delete(RecordInterface $record) { if ($record->hasFields('id')) { $con = new Condition(array('serviceId', '=', $record->id)); // check whether page exists wich uses this service if ($this->sql->count($this->registry['table.content_page'], $con) > 0) { throw new Exception('Page exists wich uses this service'); } // check whether services exist wich depend on this service // @todo $con = new Condition(array('id', '=', $record->id)); $this->table->delete($con); $this->notify(RecordAbstract::DELETE, $record); return $record; } else { throw new Exception('Missing field in record'); } }
public function delete(RecordInterface $record) { if ($record->hasFields('id')) { $con = new Condition(array('id', '=', $record->id)); $this->table->delete($con); $con = new Condition(array('accessId', '=', $record->id)); $this->hm->getTable('AmunService\\Oauth\\Access\\Right')->delete($con); $this->notify(RecordAbstract::DELETE, $record); return $record; } else { throw new Exception('Missing field in record'); } }