Commit 716bcedd authored by hartym's avatar hartym

Problem on Sluggable Listener default values merging

parent 7d6e9b29
...@@ -44,7 +44,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener ...@@ -44,7 +44,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
'length' => null, 'length' => null,
'options' => array(), 'options' => array(),
'fields' => array()); 'fields' => array());
/** /**
* __construct * __construct
* *
...@@ -53,7 +53,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener ...@@ -53,7 +53,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
*/ */
public function __construct(array $options) public function __construct(array $options)
{ {
$this->_options = array_merge($options, $this->_options); $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
} }
public function preInsert(Doctrine_Event $event) public function preInsert(Doctrine_Event $event)
...@@ -61,7 +61,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener ...@@ -61,7 +61,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
$name = $this->_options['name']; $name = $this->_options['name'];
$record = $event->getInvoker(); $record = $event->getInvoker();
if (!$record->$name) { if (!$record->$name) {
$record->$name = $this->buildSlug($record); $record->$name = $this->buildSlug($record);
} }
...@@ -80,4 +80,4 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener ...@@ -80,4 +80,4 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
return Doctrine_Inflector::urlize($value); return Doctrine_Inflector::urlize($value);
} }
} }
\ No newline at end of file
...@@ -44,7 +44,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template ...@@ -44,7 +44,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
'length' => null, 'length' => null,
'options' => array(), 'options' => array(),
'fields' => array()); 'fields' => array());
/** /**
* __construct * __construct
* *
...@@ -55,7 +55,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template ...@@ -55,7 +55,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
{ {
$this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
} }
/** /**
* setTableDefinition * setTableDefinition
* *
...@@ -64,7 +64,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template ...@@ -64,7 +64,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
public function setTableDefinition() public function setTableDefinition()
{ {
$this->hasColumn($this->_options['name'], $this->_options['type'], $this->_options['length'], $this->_options['options']); $this->hasColumn($this->_options['name'], $this->_options['type'], $this->_options['length'], $this->_options['options']);
$this->addListener(new Doctrine_Template_Listener_Sluggable($this->_options)); $this->addListener(new Doctrine_Template_Listener_Sluggable($this->_options));
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment