I'm trying to learn how to add and delete records using Active Record.
This works to add:
$instance = new Calendar37Record; $instance->timestr = $timestr; $success = $instance->save();
Given that I know the id of the record to delete, is the process to find the record and then delete it? Or can you just delete it? I tried this, but it doesn't seem to find the record, and it complains 'The active record cannot be deleted because it is new.':
$instance = new Calendar37Record; $instance->findByPk($id); $success = $instance->delete();
Thank you for any help!