I am trying to save an api call to my databases. but I am getting an error while saving to the databases
I search google and look here. I have tried the code that was offered I have not had much luck.
public function updateCalendarIfNeeded($calendarentrydata)
{
foreach($calendarentrydata as $titan)
{
$summary = $titan->summary;
$id = $titan->id;
$fileurl = $titan['attachments']['0']['fileUrl'];
$startdate = $titan->start->datetime;
$enddate = $titan->end->datetime;
$calendarpullerEntryNew = CalendarEvents::findOne([
'calendar_id' => $id
]);
if (!empty($calendarpullerEntryNew)) {
$calendarEvents = $calendarpullerEntryNew;
}
// now update entry if Calendar info found
$calendarEvents->calendar_id = $id;
$calendarEvents->calendar_summary = $summary;
$calendarEvents->calendar_start = $startdate;
$calendarEvents->calendar_end = $enddate;
$calendarEvents->file_link = $fileurl;
if (empty($calendarEvents->id)) {
$calendarEvents->save();
} else {
$calendarEvents->update();
}
}
return $calendarPullerEntry;
}
I am getting undefined method stdClass::save(). if I am not mistaking I am using Yii framework to do the save I have not used it before so I am lost
i did a var_dump on my variable and an stdclass here is the debug stdClass Object ( [calendar_id] => 1hj1o20jc6ucli4st6rk60rfic [calendar_summary] => seeing if php loves me [calendar_start] => [calendar_end] => [file_link] => https://drive.google.com/file/d/1AOPdiXtmz8oNrV2uoSNjLcLso5JdU8CM/view?usp