Fixed inconsistancy in the use of $con parameter inside sfPropelFormGeneratedTemplate #150

Merged
merged 1 commit into from Jul 11, 2012

Projects

None yet

3 participants

@laucall
laucall commented Jul 10, 2012

Hi,

When using symfony propel:build-forms, sfPropelFormGeneratedTemplate class is used as a template for building BaseXXXForms.

Inside the saveXXXList() method : $con attribute is passed as a parameter to XXXPeer::doDelete() method, whereas it's not the case for $obj->save() method.

In multiple database connection environment, this issue can lock tables. In my case : the doDelete() method is using connection 1. Rows are deleted, but no commit is done yet. After that, the $obj->save() method use the connection 2, as set in its base Peer class. But, the INSERT query sent had to wait the end of connection 1 transaction (no matter, commit or rollback).

In this case, all tables impacted by a DML query through connection 1 or 2 will be locked. The best thing you have to do then : killing the blocking session.

This issue was revealed with an Oracle database behind, but will certainly affects all others rdbms, including MySQL / InnoDB.

lcallarec Fixed issue inside generated form template
Inside the saveXXXList() method : $con attribute is passed as a
parameter to XXXPeer::doDelete() method, whereas it's not the case for
$obj->save() method. In multiple database connection environment, this
issue can lock tables.
cc9a024
@travisbot

This pull request passes (merged cc9a024 into 9177ece).

@willdurand willdurand merged commit 89779d0 into propelorm:master Jul 11, 2012
@willdurand
Member

good catch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment