1

I have doctrine model class with post save hook:

class MyClass extends BaseMyClass
{
  public function postSave($event)
  {
    myFunctionCache::getInstance()->remove(MyClassTable::CACHE_KEY_PREFIX);
  }
}

I want to clear redis data by key after saving changes of MyClass object in mysql and it's work when have not heavy load on db, but now clearing of redis happens before applying changes data in mysql. I was looking for cause and found sfFormObject::save

try
{
  $con->beginTransaction();

  $this->doSave($con);

  $con->commit();
}
catch (Exception $e)
{
  $con->rollBack();

  throw $e;
}

and postSave hook invokes in doSave, but after this commit. I try to use postTransactionCommit by additing myListener to connection, but it does not helped me. Then i try add own hook to doctrine record and trigger it after commit:

{
  $con->beginTransaction();

  $this->doSave($con);

  $con->commit();

  $event = new Doctrine_Event($this, Doctrine_Event::TX_COMMIT);
  $this->getObject()->postCommit($event);
}

This has no success also. Any advice?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.