Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #69 from davidyell/master

SoftDelete: PHP5.4 Compatibility
  • Loading branch information...
commit de878d088bed0fefe9eef35f980c9fc68cfb746f 2 parents 267ffb9 + 08f66d3
@dogmatic69 dogmatic69 authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 Model/Behavior/SoftDeleteBehavior.php
View
20 Model/Behavior/SoftDeleteBehavior.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
* Copyright 2007-2010, Cake Development Corporation (http://cakedc.com)
*
@@ -36,10 +36,10 @@ class SoftDeleteBehavior extends ModelBehavior {
/**
* Setup callback
*
- * @param object $model
+ * @param Model $model
* @param array $settings
*/
- public function setup($model, $settings = array()) {
+ public function setup(Model $model, $settings = array()) {
if (empty($settings)) {
$settings = $this->default;
} elseif (!is_array($settings)) {
@@ -67,11 +67,11 @@ public function setup($model, $settings = array()) {
/**
* Before find callback
*
- * @param object $model
+ * @param Model $model
* @param array $query
* @return array
*/
- public function beforeFind($model, $query) {
+ public function beforeFind(Model $model, $query) {
$runtime = $this->runtime[$model->alias];
if ($runtime) {
if (!is_array($query['conditions'])) {
@@ -99,11 +99,11 @@ public function beforeFind($model, $query) {
/**
* Before delete callback
*
- * @param object $model
+ * @param Model $model
* @param array $query
* @return boolean
*/
- public function beforeDelete($model) {
+ public function beforeDelete(Model $model, $cascade = true) {
$runtime = $this->runtime[$model->alias];
if ($runtime) {
$res = $this->delete($model, $model->id);
@@ -209,7 +209,7 @@ public function softDelete($model, $active) {
public function purgeDeletedCount($model, $expiration = '-90 days') {
$this->softDelete($model, false);
return $model->find('count', array(
- 'conditions' => $this->_purgeDeletedConditions($model, $expiration),
+ 'conditions' => $this->_purgeDeletedConditions($model, $expiration),
'recursive' => -1));
}
@@ -223,8 +223,8 @@ public function purgeDeletedCount($model, $expiration = '-90 days') {
public function purgeDeleted($model, $expiration = '-90 days') {
$this->softDelete($model, false);
$records = $model->find('all', array(
- 'conditions' => $this->_purgeDeletedConditions($model, $expiration),
- 'fields' => array($model->primaryKey),
+ 'conditions' => $this->_purgeDeletedConditions($model, $expiration),
+ 'fields' => array($model->primaryKey),
'recursive' => -1));
if ($records) {
foreach ($records as $record) {
Please sign in to comment.
Something went wrong with that request. Please try again.