Clear propel cache (instance pool)
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()
.
I needed to update realated objects and found out clear%modelName%
should be called.
init%modelName%
deletes all entries and related entires could never be read. clear[Related]InstancePool
don't help.
$foo = FooQuery->create()->findOne();// meanwhile somebody else updated DB and Propel don't know about that:mysql_query("INSERT INTO `foo_bars`, (`foo_id`, `bar_id`) VALUES (".$foo->getId().", 1)");// here we need some magic to force Propel re-read relation table.$foo->clearFooBars();// now entries would be re-read$foo->getFooBars();