1
0
mirror of synced 2024-12-13 06:46:03 +03:00

Problem on Sluggable Listener default values merging

This commit is contained in:
hartym 2007-12-30 18:44:00 +00:00
parent 7d6e9b29d0
commit 716bcedd76
2 changed files with 8 additions and 8 deletions

View File

@ -44,7 +44,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
'length' => null,
'options' => array(),
'fields' => array());
/**
* __construct
*
@ -53,7 +53,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
*/
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)
@ -61,7 +61,7 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
$name = $this->_options['name'];
$record = $event->getInvoker();
if (!$record->$name) {
$record->$name = $this->buildSlug($record);
}
@ -80,4 +80,4 @@ class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener
return Doctrine_Inflector::urlize($value);
}
}
}

View File

@ -44,7 +44,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
'length' => null,
'options' => array(),
'fields' => array());
/**
* __construct
*
@ -55,7 +55,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
{
$this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
}
/**
* setTableDefinition
*
@ -64,7 +64,7 @@ class Doctrine_Template_Sluggable extends Doctrine_Template
public function setTableDefinition()
{
$this->hasColumn($this->_options['name'], $this->_options['type'], $this->_options['length'], $this->_options['options']);
$this->addListener(new Doctrine_Template_Listener_Sluggable($this->_options));
}
}
}