Wednesday, December 21, 2011

Re: Problem with transaction in version 2.0

Thanks all for the help, I solved in this way:
1) I move the code form the controller to the model. (I don't really
know if this help!)
2) I used the Datasource to start the transaction. (Like explained in
the docs)
3) I commit or rollback with the datasource, but the SQLLog in the
page shows only the query, and no trace of the transaction SQL code.

Code:

inside the Model
<?php
[...]

$ds = this->getDataSource();
$ds->begin($this);
$result = $this->saveAssociated('params');
if ($result) {
$ds->commit($this); // in the doc there are no trace of this, that
i have to pass like parameter the refernce to $this.
} else {
$ds->rollback($this);
}
?>

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate