本文整理汇总了PHP中Dao::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Dao::delete方法的具体用法?PHP Dao::delete怎么用?PHP Dao::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dao
的用法示例。
在下文中一共展示了Dao::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($report)
{
parent::delete($report, self::OBJECT_CLASS);
$rs = $this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::REPORT_ID), Operator::EQUAL, intval($report->getID())))), $this->table->getName(), $report);
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $report;
}
示例2: delete
function delete($comm)
{
parent::delete($comm, self::OBJECT_CLASS);
$rs = $this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::COMMENT_ID), Operator::EQUAL, $comm->getID()))), $this->table->getName(), $comm);
if ($this->db->affected_rows() != 1) {
throw new Exception("Errore durante l'eliminazione dell'oggetto.");
}
return $comm;
}
示例3: delete
function delete($author, $post)
{
parent::delete($author, "User");
parent::delete($author, "Post");
$rs = $this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::VOTE_AUTHOR), Operator::EQUAL, intval($author->getID())), new WhereConstraint($this->table->getColumn(DB::VOTE_POST), Operator::EQUAL, intval($post->getID())))), $this->table->getName(), array("Vote", intval($author->getID()), intval($post->getID())));
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando l'oggetto. Riprovare.");
}
return true;
}
示例4: delete
function delete($contact)
{
parent::delete($contact, self::OBJECT_CLASS);
$this->db->execute(Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::CONTACT_ID), Operator::EQUAL, $contact->getID()))), $this->table->getName(), $contact);
//salvo la risorsa nella storia.
$this->saveHistory($contact, "DELETED");
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $contact;
}
示例5: delete
function delete($user)
{
parent::delete($user, self::OBJECT_CLASS);
//carico la risorsa, completa dei suoi derivati (che andrebbero persi).
$loadR = $this->loadReports;
$this->loadReports = true;
$loadD = $this->loadDependences;
$this->loadDependences = true;
$u_complete = null;
try {
$u_complete = $this->load($user->getID());
$this->loadReports = $loadR;
$this->loadDependences = $loadD;
} catch (Exception $e) {
$this->loadReports = $loadR;
$this->loadDependences = $loadD;
throw $e;
}
$this->db->execute(Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::USER_ID), Operator::EQUAL, $user->getID()))), $this->table->getName(), $user);
//salvo la risorsa nella storia.
$this->saveHistory($u_complete, "DELETED");
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $user;
}
示例6: delete
function delete($post)
{
parent::delete($post, self::OBJECT_CLASS);
//carico il post, completo dei suoi derivati (che andrebbero persi) esclusi i voti.
$loadC = $this->loadComments;
$this->loadComments = true;
$loadR = $this->loadReports;
$this->loadReports = true;
$p_complete = null;
try {
$p_complete = $this->load($post->getID());
$this->loadComments = $loadC;
$this->loadReports = $loadR;
} catch (Exception $e) {
$this->loadComments = $loadC;
$this->loadReports = $loadR;
throw $e;
}
$this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::POST_ID), Operator::EQUAL, $post->getID()))), $this->table->getName(), $post);
//salvo il post nella storia.
$this->saveHistory($p_complete, "DELETED");
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $post;
}
示例7: delete
public function delete($id)
{
$arr_id = array("id" => $id);
return parent::delete($arr_id);
}
示例8: unsubscribePost
function unsubscribePost($post, $contest)
{
parent::delete($contest, self::OBJECT_CLASS);
if (!is_subclass_of($post, "Post")) {
throw new Exception("Attenzione! Il parametro di ricerca non è un post.");
}
if (time() > $contest->getEnd()) {
throw new Exception("Questo contest è chiuso, non puoi cancellare la tua iscrizione.");
}
$this->db->execute($s = Query::generateDeleteStm($this->table_cs, array(new WhereConstraint($this->table_cs->getColumn(DB::CONTEST_SUBSCRIBER_POST), Operator::EQUAL, $post->getID()), new WhereConstraint($this->table_cs->getColumn(DB::CONTEST_SUBSCRIBER_CONTEST), Operator::EQUAL, $this->getID()))), $this->table_cs->getName(), $contest);
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando l'oggetto. Riprovare.");
}
//$this->loadSubscribers($contest); //FIXME vale la pena ricaricare il contest?
return $contest;
}