Tuesday, December 20, 2011

Re: Problem with transaction in version 2.0

On 12/20, socrates wrote:
> No in fact it does not solve my problem, but maybe i don't understand very
> well.
> This is my piece of code:
>
> $this->StadiobingoBet->query('SET AUTOCOMMIT = OFF');
> debug($this->StadiobingoBet->begin());
> if (!$this->StadiobingoBet->saveAll(null, array('atomic' => true,
> 'validate' => false))) {
> $this->StadiobingoBet->commit();
> } else {
> $this->StadiobingoBet->rollback();
> }
>

I seem to remember that model's commit and rollback functions are deprecated,
but I could be wrong; anyway, the book [1] suggests to invoke those methods on
the dataSource object (I'm not at home, so I can't confirm this is causing the
problem): give it a try.

If that does not work, try transactions inside MySQL shell, and if that works,
then analyze all the queries executed by cakephp.


Matteo

[1] http://book.cakephp.org/2.0/en/models/transactions.html?highlight=transactions

> If the query of save associated goes well, it have to rollback, but it does
> not.
>
> --
> 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
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: