I am trying to add a new structure entry within a hook.
// add new attendee
foreach($orderPage->cart() as $cartItem) {
$cartItemPage = page($cartItem['id']);
$attendees = $cartItemPage->attendees()->yaml();
$attendees[] = [
'name' => $cartItemPage->name(),
];
$cartItemPage->save([
'attendees' => Yaml::encode($attendees)
]);
}
I get this error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 221184 bytes)
Now if i just change:
$attendees[] = [
'name' => 'Bob Smith',
];
It works fine, any ideas why this is happening ?