Hi everyone!
I have a problem when trying to create a page.update:after
hook. I would like to modify another page field when updating a page but I have the following error:
Exception: Error
Call to a member function find() on null
'page.update:after' => function ($newPage, $oldPage) {
$p = $newPage->parent()->find('index');
$p->update([
'feeds' => $newPage->id()
]);
}
Apparently, the $newPage->parent()
doesn’t work, but I don’t see why since this page is a child of the homepage.
Does anybody know what’s happening?
Thanks a lot!