本文整理汇总了PHP中AppModel::beforeDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::beforeDelete方法的具体用法?PHP AppModel::beforeDelete怎么用?PHP AppModel::beforeDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::beforeDelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDelete
public function beforeDelete($cascade = true)
{
if (!empty($this->id)) {
$this->PointLog->deleteAll(array('Point_id' => $this->id));
}
return parent::beforeDelete($cascade);
}
示例2: beforeDelete
/**
* beforeDelete
*
* @param bool $cascade
* @return bool
*/
public function beforeDelete($cascade = true)
{
if (!parent::beforeDelete($cascade)) {
return false;
}
return true;
}
示例3: beforeDelete
public function beforeDelete($cascade = true)
{
/*
* to delete related orderlines
*/
$this->query("DELETE FROM {$this->OrderLine->table} WHERE order_id = '{$this->id}'");
return parent::beforeDelete($cascade);
}
示例4: beforeDelete
public function beforeDelete($cascade = true)
{
$image = $this->find('first', array('conditions' => array('Banner.id' => $this->id), 'fields' => array('Banner.img_url')));
if (count($image) > 0) {
$this->imageToDelete = $image['Banner']['img_url'];
}
parent::beforeDelete($cascade);
}
示例5: beforeDelete
public function beforeDelete($cascade = true)
{
/*
* to delete related orders/orderlines
*/
$this->query("DELETE o.*, l.* FROM {$this->Order->table} AS o " . "LEFT JOIN {$this->Order->OrderLine->table} AS l ON l.order_id = o.id " . "WHERE o.account_id = '{$this->id}'");
$tmpPath = TMP . 'zip/' . $this->id;
exec("/bin/rm -Rf {$tmpPath}");
return parent::beforeDelete($cascade);
}
示例6: beforeDelete
function beforeDelete($casca)
{
parent::beforeDelete($casca);
// chequea si contiene planes asociados, no permite
$count = $this->Plan->find('count', array('conditions' => array('Plan.titulo_id' => $this->id)));
if ($count == 0) {
return true;
} else {
$this->validationErrors[] = 'Existen Planes que tienen este tìtulo';
return false;
}
}
示例7: beforeDelete
/**
* (non-PHPdoc)
* @see Model::beforeDelete()
*/
function beforeDelete($cascade = true)
{
App::import('Model', 'BusinessDetail');
$my_model = new BusinessDetail();
$continue = parent::beforeDelete($cascade);
$this->recursive = 1;
$business = $this->find('first', array('conditions' => array('Business.id' => $this->id)));
foreach ($business['BusinessDetail'] as $businessDetails) {
$my_model->delete($businessDetails['id'], true);
}
return true;
}
示例8: beforeDelete
public function beforeDelete($cascade = false)
{
parent::beforeDelete($cascade);
$categoria = $this->find('first', array('conditions' => array('NoticiaCategoria.id' => $this->id)));
// pr($categoria);exit;
if (!empty($categoria['CategoriaFilha'][0]['id'])) {
// $this->Session->setFlash(__('This category can not be deleted because there are other categories related to it.'));
return false;
}
if (!empty($categoria['Noticia'][0]['id'])) {
// $this->Session->setFlash(__('This category cannot be deleted because there are news related to it.'));
return false;
}
return true;
}
示例9: beforeDelete
/**
* Called before every deletion operation.
*
* @param boolean $cascade If true records that depend on this record will also be deleted
*
* @return boolean True if the operation should continue, false if it should abort
*/
public function beforeDelete($cascade = true)
{
parent::beforeDelete($cascade);
$action = $this->request->params['action'];
if ($action == 'admin_delete') {
$cat = $this->find('first', array('conditions' => array('Category.id' => $this->request->params['pass'][0])));
if (count($cat['Post']) > 0) {
foreach ($cat['Post'] as $key => $value) {
$this->query("DELETE FROM `categories_posts` WHERE `categories_posts`.`post_id` = " . $value['id']);
$this->query("INSERT INTO `categories_posts` (`category_id`, `post_id`) VALUES ('1', '" . $value['id'] . "');");
}
}
$post_count = $this->find('count', array('joins' => array(array('table' => 'categories_posts', 'alias' => 'CategoriesPost', 'type' => 'INNER', 'conditions' => array('CategoriesPost.category_id' => 1))), 'group' => 'post_id'));
$this->query("UPDATE `categories` SET `post_count` = '" . $post_count . "' WHERE `categories`.`id` = 1;");
}
}
示例10: beforeDelete
public function beforeDelete($cascade = false)
{
parent::beforeDelete($cascade);
/*
$this->NoticiaComentario->deleteAll(array(
'conditions' => array(
'NoticiaComentario.noticia_id' => $this->id
)
), false);
$this->NoticiaImagem->deleteAll(array(
'conditions' => array(
'NoticiaComentario.noticia_id' => $this->id
)
), false);
*/
return true;
}
示例11: beforeDelete
/**
* 関連するユーザーを管理者グループに変更し保存する
*
* @param boolean $cascade
* @return boolean
*/
public function beforeDelete($cascade = true)
{
parent::beforeDelete($cascade);
$ret = true;
if (!empty($this->data['UserGroup']['id'])) {
$id = $this->data['UserGroup']['id'];
$this->User->unBindModel(array('belongsTo' => array('UserGroup')));
$datas = $this->User->find('all', array('conditions' => array('User.user_group_id' => $id)));
if ($datas) {
foreach ($datas as $data) {
$data['User']['user_group_id'] = Configure::read('BcApp.adminGroupId');
$this->User->set($data);
if (!$this->User->save()) {
$ret = false;
}
}
}
}
return $ret;
}
示例12: beforeDelete
public function beforeDelete($cascade = true)
{
parent::beforeDelete($cascade);
return $this->checkDependantData($this->id, 'AcionamentoCampo_Produto');
}
示例13: beforeDelete
function beforeDelete()
{
parent::beforeDelete();
return $this->id != 1;
}
示例14: beforeDelete
/**
* Before Delete
*
* 論理削除の場合、
* @param bool $cascade
* @return bool
*/
public function beforeDelete($cascade = true)
{
if (!parent::beforeDelete($cascade)) {
return false;
}
$data = $this->find('first', array('conditions' => array($this->alias . '.id' => $this->id)));
$this->__deleteTarget = $data;
if (!$this->softDelete(null)) {
return true;
}
if ($data) {
$this->deleteRelateSubSiteContent($data);
$this->deleteAlias($data);
}
return true;
}
示例15: beforeDelete
/**
* 関連するページデータをカテゴリ無所属に変更し保存する
*
* @param boolean $cascade
* @return boolean
* @access public
*/
public function beforeDelete($cascade = true)
{
parent::beforeDelete($cascade);
$id = $this->data['PageCategory']['id'];
if ($this->releaseRelatedPagesRecursive($id)) {
$path = $this->createPageCategoryFolder($this->find('first', array('conditions' => array('id' => $id))));
$folder = new Folder();
$folder->delete($path);
return true;
} else {
return false;
}
}