I’m trying to write a shell command to perform house keeping tasks on a database - stuff update time sensitive activities and records etc on a membership data base
I’ve created the follow command
class UpdateMemberShell extends AppShell {
public function main() {
App::import('Model', 'Member');
$this->Member = ClassRegistry::init('Member');
$memberList = $this->Member->find('all', [
'fields' => ['id'],
'order' => ['id' => 'ASC']
]);
if (empty($memberList) == false) {
foreach ($memberList as $member) {
$this->Member->updateDueAwards($member['Member']['id']);
}
}
}
}
It runs, it loops through the members but the save fails. I’ve thrown in checking code and the save returns false. This is the save that happens after the various logic.
if (empty($member) === false){
$member['Member']['officer_service_award_due'] = $officerServiceAwardDue;
$member['Member']['service_award_due'] = $serviceAwardDue;
$status = $this->save($member, ['callbacks' => true]);
$this->clear();
}
Same function updateDueAwards works when run from the related Awards models so its works in the app.
This one has me stumped
Thanks in advance for any assistance.
Regards,
Brian