ok i've partially solved the problem! wow!!
in my model:
ClassRegistry::init('Referente');
$Referente = new Referente();
$Referente->CodiceReferente = $elettorez['Elettore']
['ReferenteElettore']; //CodiceReferente is primary key!!
$oldpreferenze=$Referente->field('PreferenzePrevisteReferente');
$actual=(($elettorez['Elettore']['PersoneCollegate']*
$elettorez['Elettore']['ProbabilitaDiVoto'])/100);
$dataSource = $this->getDataSource();
$dataSource->begin($this);
$newpreferenze=$oldpreferenze+$actual;
if($this->save($elettorez)) // ok
{
if($Referente->saveField('PreferenzePrevisteReferente',
$newpreferenze)) // !! insert!
{
return
$dataSource->commit($this);
}
}
$dataSource->rollback($this);
return false;
the problem is that saveField make an insert instead of an update
--
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