I'm using doctrine/mongodb 1.0.0-BETA1 in a symfony2.1 install.
So i'm trying to force my repository to call data from my database instead of using the object it has cached.
$audit = $dm->getRepository("WGenSimschoolsBundle:Audit")->findOneById("xxxx");
.... do something somewhere to change the object ....
At this point if I call
$audit = $dm->getRepository("WGenSimschoolsBundle:Audit")->findOneById("xxxx");
The audit data hasn't changed. It still has the object it originally fetched. If I try to
$dm->refresh($audit)
I get the same thing. Is there anyway for me to go back to the database for the value?
Have you flushed your changes to the $audit
object?
$audit = $dm->getRepository("WGenSimschoolsBundle:Audit")->findOneById("xxxx");
//do something somewhere to change the object
$dm->flush();
Every time you do a findBy(...)
or findOneBy(...)
it actually fetches a new document from the DB. (you should see the query in the Symfony profiler)
With a find() instead, it will fetch the document from his internal proxy cache.
The Documents stay in the proxy cache until you call the $dm->clear()
method.