And what about relations?

Do I have to manually clear all involved tables?

Is there a shortcut to clear all tables?

Thanks, Klemens

On Aug 9, 12:22 pm, Bernhard Schussek <[email protected]> wrote:
> Hi Klemens,
>
> I usually write a custom finder method for the purpose of the test
> that calls clear() on the Doctrine table object before retrieving the
> object anew.
>
> function find_article($id)
> {
>   Doctrine::getTable('Article')->clear();
>
>   return Doctrine::getTable('Article')->find($id);
>
> }
>
> Doctrine caches all records by ID internally, so that one record is
> not retrieved twice when querying for it by ID. With clear() you can
> clear that cache and make sure that the object is actually retrieved
> from the DB.
>
> In the test, you can then simply "reload" the object:
>
> $article = ....
> // do something here
> $article = find_article($article->id);
> // make sure some data was saved
>
> Bernhard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to