1 to 3 of 3
First, do not use findBySQL. You should really get used to using find() instead. I dont have the latest trunk of Akelos so if using references ( =& ) below causes warnings, take out the "&".
$signals =& $this->Signal->find('all',
array( 'conditions' => array(
"meter_id=? AND signals.id<>?", $meterid, $signalID)
)
);
foreach($signals as $signal) {
$signal->to_be_plotted = 0; //change the to_be_plotted to 0
$signal->save(); //save it
#look at your groups table for this signal id. Do the same for groups_signals
$group =& $this->Group->find('first',
array('conditions' => array(
"signal_id=?", $signal->id)
)
)
if( !empty ( $group ) ) { //if that signal id does not exist, add it
$group->signal_id = $signal->id; //set the signal id of this signal
$group->save(); //save the group
}
}
Hope this helps. It is definitely a step in the right direction for what you want to do. Forgive me if there are any syntax errors or typos.
1 to 3 of 3