ソースを参照

Removed unused option `triggerDisabled` from ObjectCollection::trigger().
Fixed docblock for ObjectCollection::load();

ADmad 14 年 前
コミット
a7d08a6b39

+ 0 - 24
lib/Cake/Test/Case/Utility/ObjectCollectionTest.php

@@ -190,30 +190,6 @@ class ObjectCollectionTest extends CakeTestCase {
 	}
 
 /**
- * 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
  *
  * @return void

+ 1 - 8
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.'));
 		}