本文整理汇总了PHP中Jam::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Jam::delete方法的具体用法?PHP Jam::delete怎么用?PHP Jam::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jam
的用法示例。
在下文中一共展示了Jam::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id = NULL)
{
parent::__construct($id);
if (mt_rand(1, 100) === 1) {
Jam::delete($this)->expired()->execute();
}
}
示例2: test_expired
public function test_expired()
{
$current_time = time();
$expected_sql = "DELETE FROM `test_user_tokens` WHERE `test_user_tokens`.`expires` < {$current_time}";
$sql = (string) Jam::delete('test_user_token')->expired(TRUE, $current_time);
$this->assertEquals($expected_sql, $sql);
}
示例3: _delete_item
/**
* Delete an item with a specific key from the database
* @param string $foreign_model
* @param string $key
* @return Database_Result
*/
protected function _delete_item($foreign_model, $key)
{
if (!$foreign_model) {
return NULL;
}
return Jam::delete($foreign_model)->where_key($key)->execute();
}
示例4: erase_query
public function erase_query(Jam_Model $model)
{
$descendant_ids = $this->descendants_query($model->id())->where($this->depth_key, '>', 0)->execute($model->meta()->db())->as_array(NULL, $this->descendant_key);
return Jam::delete($this->foreign_model)->where_key($descendant_ids);
}
示例5: delete
/**
* Deletes a single record.
*
* @return boolean
**/
public function delete()
{
$result = FALSE;
// Are we loaded? Then we're just deleting this record
if ($this->_loaded) {
$key = $this->_original[$this->meta()->primary_key()];
if (($result = $this->meta()->events()->trigger('model.before_delete', $this)) !== FALSE) {
$result = Jam::delete($this)->where_key($key)->execute();
}
}
// Trigger the after-delete
$this->meta()->events()->trigger('model.after_delete', $this, array($result));
// Clear the object so it appears deleted anyway
$this->clear();
// Set the flag indicatig the model has been successfully deleted
$this->_deleted = $result;
return $this->_deleted;
}