1
0
mirror of synced 2025-01-18 14:31:40 +03:00

moved hydration listeners to record listener

This commit is contained in:
zYne 2007-10-07 22:43:04 +00:00
parent dc4d96e92f
commit 52346aa6c5
7 changed files with 33 additions and 24 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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'];

View File

@ -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;
}
}
}

View File

@ -67,4 +67,10 @@ class Doctrine_Record_Listener implements Doctrine_Record_Listener_Interface
public function postInsert(Doctrine_Event $event)
{ }
}
public function preHydrate(Doctrine_Event $event)
{ }
public function postHydrate(Doctrine_Event $event)
{ }
}

View File

@ -169,4 +169,18 @@ class Doctrine_Record_Listener_Chain extends Doctrine_Access implements Doctrine
$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);
}
}
}

View File

@ -55,4 +55,8 @@ interface Doctrine_Record_Listener_Interface
public function preInsert(Doctrine_Event $event);
public function postInsert(Doctrine_Event $event);
}
public function preHydrate(Doctrine_Event $event);
public function postHydrate(Doctrine_Event $event);
}