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