Skip to content

Commit f34cfd1

Browse files
committed
Updating EmailComponent to use new methods on the ComponentCollection to ensure it always has a controller reference.
Removing triggerDisabled key as its no longer needed or wanted.
1 parent 273a189 commit f34cfd1

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

cake/libs/controller/components/email.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,23 @@ class EmailComponent extends Component {
298298
*/
299299
protected $_smtpConnection = null;
300300

301+
/**
302+
* Constructor
303+
*
304+
* @param ComponentCollection $collection A ComponentCollection this component can use to lazy load its components
305+
* @param array $settings Array of configuration settings.
306+
*/
307+
public function __construct(ComponentCollection $collection, $settings = array()) {
308+
$this->Controller = $collection->getController();
309+
parent::__construct($collection, $settings);
310+
}
311+
301312
/**
302313
* Initialize component
303314
*
304315
* @param object $controller Instantiating controller
305316
*/
306317
public function initialize(&$controller) {
307-
$this->Controller = $controller;
308318
if (Configure::read('App.encoding') !== null) {
309319
$this->charset = Configure::read('App.encoding');
310320
}

cake/libs/controller/controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ public function getResponse() {
533533
* @return void
534534
*/
535535
public function startupProcess() {
536-
$this->Components->trigger('initialize', array(&$this), array('triggerDisabled' => true));
536+
$this->Components->trigger('initialize', array(&$this));
537537
$this->beforeFilter();
538538
$this->Components->trigger('startup', array(&$this));
539539
}

cake/tests/cases/libs/controller/controller.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ function testStartupProcess() {
14781478

14791479
$Controller->expects($this->once())->method('beforeFilter');
14801480
$Controller->Components->expects($this->at(0))->method('trigger')
1481-
->with('initialize', array(&$Controller), array('triggerDisabled' => true));
1481+
->with('initialize', array(&$Controller));
14821482

14831483
$Controller->Components->expects($this->at(1))->method('trigger')
14841484
->with('startup', array(&$Controller));

0 commit comments

Comments
 (0)