简体   繁体   中英

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.

$parent->reload(true)

应该推动

从未使用过它,但是您可能正在寻找Doctrine_Record#refresh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM