Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Model/Behavior/HabtmCounterCacheBehavior.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
App::uses('ModelBehavior', 'Model');
/**
* Provides Counter Cache and Under Counter Cache (for hierarchical models)
* behavior with scope for HABTM associations e.g. Post habtm Tag,Category where
Expand Down Expand Up @@ -85,7 +86,7 @@ class HabtmCounterCacheBehavior extends ModelBehavior {
* ),
* );
*/
public function setup(&$model, $config = null) {
public function setup(Model $model, $config = array()) {

// Work out the default names of what we expect the counter cache and under
// counter cache fields to be. These will be overridden if specified in the
Expand Down Expand Up @@ -208,7 +209,7 @@ protected function _config2settings($config) {
* @param AppModel $model
* @return boolean Always true
*/
public function beforeSave(&$model) {
public function beforeSave(Model $model) {

// If no model->id, inserting, so return
if (!$model->id) {
Expand Down Expand Up @@ -251,7 +252,7 @@ protected function _setOldHabtmIds(&$model) {
* @param boolean $created
* @return boolean Always true
*/
public function afterSave(&$model, $created) {
public function afterSave(Model $model, $created) {

$this->_setNewHabtmIds($model);

Expand Down Expand Up @@ -306,7 +307,7 @@ protected function _setNewHabtmIds($model) {
* @param AppModel $model
* @return boolean Always true
*/
function beforeDelete(&$model) {
function beforeDelete(Model $model, $cascade = true) {

$this->_setOldHabtmIds($model);

Expand All @@ -320,7 +321,7 @@ function beforeDelete(&$model) {
*
* @param AppModel $model
*/
function afterDelete(&$model) {
function afterDelete(Model $model) {

$this->_updateCounterCache($model);

Expand Down