Search code examples
phpormsymfony1propel

How to force refetch of association results in Propel (also Doctrine) - Symfony 1.4?


I have 2 entities: Parent with one-to-many relationship with Child.

I use the $parent->getChilds() automatically generated method by Propel to fetch all the childs.

Afterwards I manually add (or remove) some new childs in different method:

$child = new Child();
$child->setParentId($parent->getId());
$child->save();

Now if I recall the getChilds method I get the same original childs (and also no extra query to the database).

I understand that this is better behaviour and more efficient, but is there a way to force to refetch?

Thanks.


Solution

  • $parent->reload(true)

    Should work in propel