本文整理汇总了PHP中DB_DataObject::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_DataObject::delete方法的具体用法?PHP DB_DataObject::delete怎么用?PHP DB_DataObject::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_DataObject
的用法示例。
在下文中一共展示了DB_DataObject::delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete()
{
$result = parent::delete();
if ($result != FALSE) {
$this->removeFromSolr();
}
return $result;
}
示例2: delete
public function delete($useWhere = false)
{
// avoid those annoying PEAR::DB strict standards warnings it causes
$old = error_reporting();
error_reporting(error_reporting() & ~E_STRICT);
$res = parent::delete($useWhere);
// reset
error_reporting($old);
return $res;
}
示例3: delete
function delete()
{
$personId = $this->personId;
$ret = parent::delete();
//Load the person this is for, and update solr
if ($personId) {
require_once ROOT_DIR . '/sys/Genealogy/Person.php';
$person = Person::staticGet('personId', $personId);
$person->saveToSolr();
}
return $ret;
}
示例4: delete
public function delete()
{
//Delete any items that are associated with the record
if (strcasecmp($this->source, 'OverDrive') != 0) {
$items = $this->getItems();
foreach ($items as $item) {
$item->delete();
}
}
parent::delete();
}
示例5: delete
/**
* Deletes items from table which match current objects variables.
*
* Returns the true on success
*
* for example
*
* Designed to be extended
*
* $object = new mytable();
* $object->ID=123;
* echo $object->delete(); // builds a conditon
*
* $object = new mytable();
* $object->whereAdd('age > 12');
* $object->limit(1);
* $object->orderBy('age DESC');
* $object->delete(true); // dont use object vars, use the conditions, limit and order.
*
* @param bool $useWhere (optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then
* we will build the condition only using the whereAdd's. Default is to
* build the condition only using the object parameters.
*
* * @return mixed Int (No. of rows affected) on success, false on failure, 0 on no data affected
*/
public function delete($useWhere = FALSE)
{
$result = parent::delete($useWhere);
$event = new \Civi\Core\DAO\Event\PostDelete($this, $result);
\Civi::service('dispatcher')->dispatch("DAO::post-delete", $event);
return $result;
}
示例6: delete
/**
* Overwrite DB_DataObject::delete() method and add a "ON DELETE CASCADE"
*
* @param boolean $useWhere
* @param boolean $cascadeDelete If true it deletes also referenced tables
* if this behavior is set in DataObject.
* With this parameter it's possible to turn off default behavior
* @see DB_DataObjectCommon:onDeleteCascade
* @param boolean $parentid The audit ID of the parent object causing the cascade.
* @return mixed True on success, false on failure, 0 on no data affected
* @access protected
*/
function delete($useWhere = false, $cascadeDelete = true, $parentid = null)
{
$this->_addPrefixToTableName();
// clone this object and retrieve current values for auditing
$doAffected = clone $this;
if (!$useWhere) {
// Clear any additional WHEREs if it's not used in delete statement
$doAffected->whereAdd();
}
$doAffected->find();
if ($this->onDeleteCascade && $cascadeDelete) {
$aKeys = $this->keys();
// Simulate "ON DELETE CASCADE"
if (count($aKeys) == 1) {
// Resolve references automatically only for records with one column as Primary Key
// If table has more than one column in PK it is still possible to remove
// manually connected tables (by overriding delete() method)
$primaryKey = $aKeys[0];
$linkedRefs = $this->_collectRefs($primaryKey);
foreach ($this->onDeleteCascadeSkip as $table) {
unset($linkedRefs[$table]);
}
// Find all affected tuples
while ($doAffected->fetch()) {
$id = $doAffected->audit(3, null, $parentid);
// Simulate "ON DELETE CASCADE"
$doAffected->deleteCascade($linkedRefs, $primaryKey, $id);
}
}
}
$result = parent::delete($useWhere);
if ($result) {
if (is_null($id)) {
$doAffected->fetch();
$doAffected->audit(3, null, $parentid);
}
return true;
}
return $result;
}
示例7: delete
function delete()
{
$this->decache();
# while we still have the values!
return parent::delete();
}
示例8: delete
public function delete()
{
$result = $this->trigger('delete');
switch (true) {
case $result === 'bypass':
$this->clearFromRegistry($this->tableName(), $this->pk());
return true;
break;
case $result === 'fail':
return false;
break;
default:
if (parent::delete() !== false) {
$this->clearFromRegistry($this->tableName(), $this->pk());
$this->trigger('postdelete');
return true;
}
return false;
}
}
示例9: delete
function delete()
{
$ret = parent::delete();
return $ret;
}