propelorm / Propel

Current stable (and outdated and unmaintained) version of Propel - Please use v2 https://github.com/propelorm/Propel2 --
http://www.propelorm.org
MIT License
841 stars 417 forks source link

lock rows support #640

Open vurentjie opened 11 years ago

vurentjie commented 11 years ago

i was contemplating using propel today because it seems like a perfect alternative to my custom neset set model i have been using in a project, the only thing that came up was the lack of row locking,

i currently use codeigniter for most of my projects, i had to extend its active record class as well to include methods like these to help me, of course not all db types support this, but it is still critical for me in some transactions, so i put to together some methods to allow this, simple usage examples for ci:

$this->select('*')->lock('update')->get()->result();
$this->select('*')->lock('shared')->get()->result();

also most of this is possible if you just type out a custom sql string, but that can become tiresome having to escape input data all the time

the propel docs on inheritance are mostly about the xml based inheritance, and nothing i could see on how to extend the core php classes themselves (maybe i missed something)

so i've also had a quick glance at the propel source to see where i would need to look to achieve something similar,

i assume i have to delve into the object and nested builders ? is there a standard way to extend these classes and to configure to use my extended builder or would i have to come up with my own solution ?

havvg commented 11 years ago

You could write a behavior, which adds the methods and translate into the correct query syntax. Then you can add this behavior database wide.

vurentjie commented 11 years ago

thanks for the reply, that is a good solution

willdurand commented 11 years ago

:+1: for the behavior