Bump! On Tue, Dec 13, 2011 at 12:18 AM, Matteo Landi <[email protected]> wrote: > Hi everybody, > > could someone tell me what tables get locked during an explicit > CakePHP transaction? > > $dataSource = $this->getDataSource(); > $dataSource->begin(); > // transaction logic > $dataSource->commit(); // or $dataSource->rollback(); > > Imagine to update a Post if and only if it exists; we can use > transactions (a bit overkill, but was worth the example) and implement > a method like this: > > public function update($data) { > $dataSource = $this->getDataSource(); > $dataSource->begin(); > > $this->id = $data['id']; > if (!$this->exists() || !$this->save($data)) { > $dataSource->rollback(); > return false; > } > > $dataSource->commit(); // or $dataSource->rollback(); > } > > Are all the tables linked to Post model, locked inside the > transaction? If so, how can a developer avoid that? Maybe writing > straight SQL statements? > > > Regards, > Matteo > > -- > http://www.matteolandi.net/
-- http://www.matteolandi.net/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
