Commit 5b594a54 authored by zYne's avatar zYne

some methods added

parent 42c7dd6f
...@@ -93,6 +93,16 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite ...@@ -93,6 +93,16 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
{ {
return array_pop($this->_queries); return array_pop($this->_queries);
} }
/**
* reset
*
* removes all queries from the query stack
* @return void
*/
public function reset()
{
$this->_queries = array();
}
/** /**
* count * count
* *
...@@ -102,6 +112,15 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite ...@@ -102,6 +112,15 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
{ {
return count($this->_queries); return count($this->_queries);
} }
/**
* getIterator
*
* @return ArrayIterator an iterator that iterates through the query stack
*/
public function getIterator()
{
return new ArrayIterator($this->_queries);
}
/** /**
* save * save
* *
...@@ -151,7 +170,7 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite ...@@ -151,7 +170,7 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
} }
public function onQuery(Doctrine_Db_Event $event) public function onQuery(Doctrine_Db_Event $event)
{ {
$this->addQuery($event->getQuery(), $event->getInvoker()->getName()); $this->add($event->getQuery(), $event->getInvoker()->getName());
} }
public function onPrePrepare(Doctrine_Db_Event $event) public function onPrePrepare(Doctrine_Db_Event $event)
...@@ -178,6 +197,6 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite ...@@ -178,6 +197,6 @@ class Doctrine_Cache extends Doctrine_Db_EventListener implements Countable, Ite
} }
public function onExecute(Doctrine_Db_Event $event) public function onExecute(Doctrine_Db_Event $event)
{ {
$this->addQuery($event->getQuery(), $event->getInvoker()->getName()); $this->add($event->getQuery(), $event->getInvoker()->getName());
} }
} }
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