Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

reload after insert / update does not use right connection #727

Open
raebbar opened this Issue Jul 22, 2013 · 2 comments

Comments

Projects
None yet
2 participants

raebbar commented Jul 22, 2013

If you use the reloadAfterInsert feature, Propel generates a wrong call of the reload method within the doSave method. Because of that the database connection is not passed to the reload method. In combination with transactions and a master slave setup saving a object will end up in an error, because the object is saved within the write connection on master, but not yet available on read connections which are used by default.

possible patch

Index: lib/PEAR/data/propel_generator/lib/builder/om/PHP5ObjectBuilder.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lib/PEAR/data/propel_generator/lib/builder/om/PHP5ObjectBuilder.php (revision 25583)
+++ lib/PEAR/data/propel_generator/lib/builder/om/PHP5ObjectBuilder.php (revision )
@@ -4601,7 +4601,7 @@
         if ($reloadOnInsert || $reloadOnUpdate) {
             $script .= "
             if (\$reloadObject) {
-                \$this->reload(\$con);
+                \$this->reload(false, \$con);
             }
 ";
         }

we are using Propel 1.6.8

Member

staabm commented Jul 22, 2013

could you please verify if this problem also appear in the latest propel release?

If so a unit test would be great.

raebbar commented Jul 25, 2013

On Mon, Jul 22, 2013 at 11:42 AM, Markus Staab notifications@github.comwrote:

could you please verify if this problem also appear in the latest propel
release?

Yes, the problem also appears in the last propel (1.X) release. I didn't
checked Propel2.

If so a unit test would be great.

I will write one when I'm back from vacation in 2 weeks.


Reply to this email directly or view it on GitHubhttps://github.com/propelorm/Propel/issues/727#issuecomment-21333982
.

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