mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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.
This commit is contained in:
parent
273a189e98
commit
f34cfd1f1e
3 changed files with 13 additions and 3 deletions
|
@ -298,13 +298,23 @@ class EmailComponent extends Component {
|
|||
*/
|
||||
protected $_smtpConnection = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ComponentCollection $collection A ComponentCollection this component can use to lazy load its components
|
||||
* @param array $settings Array of configuration settings.
|
||||
*/
|
||||
public function __construct(ComponentCollection $collection, $settings = array()) {
|
||||
$this->Controller = $collection->getController();
|
||||
parent::__construct($collection, $settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize component
|
||||
*
|
||||
* @param object $controller Instantiating controller
|
||||
*/
|
||||
public function initialize(&$controller) {
|
||||
$this->Controller = $controller;
|
||||
if (Configure::read('App.encoding') !== null) {
|
||||
$this->charset = Configure::read('App.encoding');
|
||||
}
|
||||
|
|
|
@ -533,7 +533,7 @@ class Controller extends Object {
|
|||
* @return void
|
||||
*/
|
||||
public function startupProcess() {
|
||||
$this->Components->trigger('initialize', array(&$this), array('triggerDisabled' => true));
|
||||
$this->Components->trigger('initialize', array(&$this));
|
||||
$this->beforeFilter();
|
||||
$this->Components->trigger('startup', array(&$this));
|
||||
}
|
||||
|
|
|
@ -1478,7 +1478,7 @@ class ControllerTest extends CakeTestCase {
|
|||
|
||||
$Controller->expects($this->once())->method('beforeFilter');
|
||||
$Controller->Components->expects($this->at(0))->method('trigger')
|
||||
->with('initialize', array(&$Controller), array('triggerDisabled' => true));
|
||||
->with('initialize', array(&$Controller));
|
||||
|
||||
$Controller->Components->expects($this->at(1))->method('trigger')
|
||||
->with('startup', array(&$Controller));
|
||||
|
|
Loading…
Reference in a new issue