Hello,

I'm having what seems to be a concurrency problem while using Propel
1.3. Below is a small example of the "save" method of a Propel object.

    public function save(PropelPDO $con = null) {
        $con = Propel::getConnection();
        try {
            $con->beginTransaction();
            sleep(3); // ignore this, used for testing only
            parent::save($con);
            $foo = $this->getFoo(); // Propel object, triggers a
SELECT

            // stuff is happening here...

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

The problem is the $foo object. Let's say we get two calls of the
example method one after another in a very short time. In some cases,
if the second transaction reads $foo...

    $foo = $this->getFoo();

... before the first transaction has had the chance to save it...

    $foo->save($con);

... $foo read by the second transaction will be outdated and bad
things will happen.

How can I force the locking of the table Foo objects are stored in so
that subsequent transactions can read from it only after the first one
has finished its work?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to