Skip to content

Commit

Permalink
Merge settings instead of overwriting them.
Browse files Browse the repository at this point in the history
Merging is far more useful than overwriting as components
can provide useful defaults without having to define fistfuls of
properties.
  • Loading branch information
markstory committed Nov 8, 2013
1 parent 3244fad commit aa6a3e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Cake/Controller/Component.php
Expand Up @@ -99,7 +99,7 @@ class Component extends Object implements EventListener {
*/
public function __construct(ComponentRegistry $registry, $settings = []) {
$this->_registry = $registry;
$this->settings = $settings;
$this->settings = array_merge($this->settings, $settings);
$this->_set($settings);
if (!empty($this->components)) {
$this->_componentMap = $registry->normalizeArray($this->components);
Expand Down

0 comments on commit aa6a3e4

Please sign in to comment.