From a7d08a6b39b708559a4a95cb21e244f4ac050098 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 6 Nov 2011 20:29:46 +0530 Subject: [PATCH] Removed unused option `triggerDisabled` from ObjectCollection::trigger(). Fixed docblock for ObjectCollection::load(); --- .../Case/Utility/ObjectCollectionTest.php | 24 ------------------- lib/Cake/Utility/ObjectCollection.php | 9 +------ 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php index 5bd7f2440..39cba4ae5 100644 --- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php +++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php @@ -189,30 +189,6 @@ class ObjectCollectionTest extends CakeTestCase { $this->assertTrue($this->Objects->trigger('callback')); } -/** - * test that the initalize callback is triggered on all components even those that are disabled. - * - * @return void - */ - public function testTriggerWithTriggerDisabledObjects() { - $this->_makeMockClasses(); - $this->Objects->load('TriggerMockFirst', array(), false); - $this->Objects->load('TriggerMockSecond'); - - $this->mockObjects[] = $this->Objects->TriggerMockFirst; - $this->mockObjects[] = $this->Objects->TriggerMockSecond; - - $this->Objects->TriggerMockFirst->expects($this->once()) - ->method('callback') - ->will($this->returnValue(true)); - $this->Objects->TriggerMockSecond->expects($this->once()) - ->method('callback') - ->will($this->returnValue(true)); - - $result = $this->Objects->trigger('callback', array(), array('triggerDisabled' => true)); - $this->assertTrue($result); - } - /** * test trigger and disabled objects * diff --git a/lib/Cake/Utility/ObjectCollection.php b/lib/Cake/Utility/ObjectCollection.php index 9406b76c6..c3fdeed6b 100644 --- a/lib/Cake/Utility/ObjectCollection.php +++ b/lib/Cake/Utility/ObjectCollection.php @@ -42,7 +42,7 @@ abstract class ObjectCollection { /** * Loads a new object onto the collection. Can throw a variety of exceptions * - * Implementations of this class support a `$options['callbacks']` flag which enables/disables + * Implementations of this class support a `$options['enabled']` flag which enables/disables * a loaded object. * * @param string $name Name of object to load. @@ -68,9 +68,6 @@ abstract class ObjectCollection { * - `collectReturn` Set to true to collect the return of each object into an array. * This array of return values will be returned from the trigger() call. Defaults to `false`. * - * - `triggerDisabled` Will trigger the callback on all objects in the collection even the non-enabled - * objects. Defaults to false. - * * - `modParams` Allows each object the callback gets called on to modify the parameters to the next object. * Setting modParams to an integer value will allow you to modify the parameter with that index. * Any non-null value will modify the parameter index indicated. @@ -93,16 +90,12 @@ abstract class ObjectCollection { 'break' => false, 'breakOn' => false, 'collectReturn' => false, - 'triggerDisabled' => false, 'modParams' => false ), $options ); $collected = array(); $list = $this->_enabled; - if ($options['triggerDisabled'] === true) { - $list = array_keys($this->_loaded); - } if ($options['modParams'] !== false && !isset($params[$options['modParams']])) { throw new CakeException(__d('cake_dev', 'Cannot use modParams with indexes that do not exist.')); }