Search code examples
symfonypropel

Clear propel cache (instance pool)


I need to force reread data from DB within one php execution, using propel. I already have a bit hacky solution: call init%modelName% for corresponding classes, but want something better.

Is there any single call or service config option for that? Like killing whole instance pool.

About service: we use symfony2 and don't need cache only in one specific case, hence we can create even separate environment for that.


Solution

  • You can globally disable the instance pooling by calling: Propel::disableInstancePooling() (Propel::enableInstancePooling() is useful to enable the instance pooling).

    Otherwise, you can rely on PEER classes which contain generated methods like clearInstancePool(), and clearRelatedInstancePool().