Commit 52346aa6 authored by zYne's avatar zYne

moved hydration listeners to record listener

parent dc4d96e9
......@@ -345,19 +345,6 @@ class Doctrine_EventListener_Chain extends Doctrine_Access implements Doctrine_E
}
}
public function preHydrate(Doctrine_Event $event)
{
foreach ($this->_listeners as $listener) {
$listener->preHydrate($event);
}
}
public function postHydrate(Doctrine_Event $event)
{
foreach ($this->_listeners as $listener) {
$listener->postHydrate($event);
}
}
public function preFetch(Doctrine_Event $event)
{
foreach ($this->_listeners as $listener) {
......
......@@ -58,9 +58,6 @@ interface Doctrine_EventListener_Interface
public function preError(Doctrine_Event $event);
public function postError(Doctrine_Event $event);
public function preHydrate(Doctrine_Event $event);
public function postHydrate(Doctrine_Event $event);
public function preFetch(Doctrine_Event $event);
public function postFetch(Doctrine_Event $event);
......
......@@ -1033,7 +1033,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$table = $this->_aliasMap[$rootAlias]['table'];
$componentName = $table->getComponentName();
$event->set('data', $currData[$rootAlias]);
$table->getListener()->preHydrate($event);
$table->getRecordListener()->preHydrate($event);
$element = $driver->getElement($currData[$rootAlias], $componentName);
$oneToOne = false;
......@@ -1041,7 +1041,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$index = $driver->search($element, $array);
if ($index === false) {
$event->set('data', $element);
$table->getListener()->postHydrate($event);
$table->getRecordListener()->postHydrate($event);
if (isset($this->_aliasMap[$rootAlias]['map'])) {
$key = $this->_aliasMap[$rootAlias]['map'];
......@@ -1068,7 +1068,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
$table = $this->_aliasMap[$alias]['table'];
$componentName = $table->getComponentName();
$event->set('data', $data);
$table->getListener()->preHydrate($event);
$table->getRecordListener()->preHydrate($event);
$element = $driver->getElement($data, $componentName);
......@@ -1092,7 +1092,7 @@ class Doctrine_Hydrate extends Doctrine_Locator_Injectable implements Serializab
if ($index === false) {
$event->set('data', $element);
$table->getListener()->postHydrate($event);
$table->getRecordListener()->postHydrate($event);
if (isset($map['map'])) {
$key = $map['map'];
......
......@@ -787,6 +787,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
return $this->_references[$name];
} catch(Doctrine_Table_Exception $e) {
foreach ($this->_table->getFilters() as $filter) {
if (($value = $filter->filterGet($this, $name, $value)) !== null) {
return $value;
......@@ -1631,4 +1632,4 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
{
return (string) $this->_oid;
}
}
\ No newline at end of file
}
......@@ -67,4 +67,10 @@ class Doctrine_Record_Listener implements Doctrine_Record_Listener_Interface
public function postInsert(Doctrine_Event $event)
{ }
}
\ No newline at end of file
public function preHydrate(Doctrine_Event $event)
{ }
public function postHydrate(Doctrine_Event $event)
{ }
}
......@@ -169,4 +169,18 @@ class Doctrine_Record_Listener_Chain extends Doctrine_Access implements Doctrine
$listener->postInsert($event);
}
}
}
\ No newline at end of file
public function preHydrate(Doctrine_Event $event)
{
foreach ($this->_listeners as $listener) {
$listener->preHydrate($event);
}
}
public function postHydrate(Doctrine_Event $event)
{
foreach ($this->_listeners as $listener) {
$listener->postHydrate($event);
}
}
}
......@@ -55,4 +55,8 @@ interface Doctrine_Record_Listener_Interface
public function preInsert(Doctrine_Event $event);
public function postInsert(Doctrine_Event $event);
}
\ No newline at end of file
public function preHydrate(Doctrine_Event $event);
public function postHydrate(Doctrine_Event $event);
}
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