Skip to content
Permalink
Browse files

Add afterSaveCommit and afterDeleteCommit callbacks to behaviours

  • Loading branch information...
dakota committed Oct 29, 2015
1 parent 701aa2a commit 2099cad5243d9d3ea3204a7271230c6be1bd1377
Showing with 14 additions and 0 deletions.
  1. +2 −0 src/ORM/Behavior.php
  2. +12 −0 tests/TestCase/ORM/BehaviorTest.php
@@ -252,8 +252,10 @@ public function implementedEvents()
'Model.beforeFind' => 'beforeFind',
'Model.beforeSave' => 'beforeSave',
'Model.afterSave' => 'afterSave',
'Model.afterSaveCommit' => 'afterSaveCommit',
'Model.beforeDelete' => 'beforeDelete',
'Model.afterDelete' => 'afterDelete',
'Model.afterDeleteCommit' => 'afterDeleteCommit',
'Model.buildValidator' => 'buildValidator',
'Model.buildRules' => 'buildRules',
'Model.beforeRules' => 'beforeRules',
@@ -50,6 +50,13 @@ public function afterRules()
public function buildRules()
{
}
/**
* Test for event bindings.
*/
public function afterSaveCommit()
{
}
}
/**
@@ -209,6 +216,7 @@ public function testImplementedEvents()
$behavior = new TestBehavior($table);
$expected = [
'Model.beforeFind' => 'beforeFind',
'Model.afterSaveCommit' => 'afterSaveCommit',
'Model.buildRules' => 'buildRules',
'Model.beforeRules' => 'beforeRules',
'Model.afterRules' => 'afterRules',
@@ -230,6 +238,10 @@ public function testImplementedEventsWithPriority()
'priority' => 10,
'callable' => 'beforeFind'
],
'Model.afterSaveCommit' => [
'priority' => 10,
'callable' => 'afterSaveCommit'
],
'Model.beforeRules' => [
'priority' => 10,
'callable' => 'beforeRules'

0 comments on commit 2099cad

Please sign in to comment.
You can’t perform that action at this time.