I have found this helpful example http://tv.cakephp.org/video/guille1983/2011/01/10/database_transactions
and i have copy the source of https://github.com/gmansilla/Transactions-and-Cakephp
so my code in controller is like
function add()
{
if(isset($this->data))
{
$authstring=$this->Session->read('Auth.User');
$referente=$authstring['username'];
$this->data['Elettore']['ReferenteElettore']=$referente;
if($this->Elettore->aggiungi($this->data, $referente))
....
and inside my model the function "aggiungi" but when i try to add
stuff, i got this:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'aggiungi' at line 1 [CORE/cake/libs/model/datasources/
dbo_source.php, line 684]
Why cakephp try to exec sql query "aggiungi"? :(
my model is
class Elettore extends AppModel {
var $useTable = 'elettores';
var $name = 'Elettore';
[...]
function aggiungi($data, $referente){
if ($data && $referente) {
ClassRegistry::init('Referente'); //get an instance of Model
Referente
$Referente = new Referente();
...
transaction stuff
...
--
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:
Post a Comment