Inxentas Posted 3 hours ago Share Posted 3 hours ago (edited) I add some pages to a PageReferences field that I've set to Multiple Pages PageArray. I add stuff to it like this, which works fine. $user->of(false); $newfav = $pages->find($id); $user->favs->add($newfav); $user->save(); I'm trying to remove some items from it, but this doesn't seem to do anything. Here's the code: if($user->isLoggedin()) { $found = false; foreach($user->favs as $fav){ if($fav->id === $id){ $found = true; } } if($found){ $user->of(false); $newfav = $pages->find($id); $user->favs->remove($newfav); $user->save(); } } I already fixed an error where the $id variable wasn't an integer, I'm sure that I end up finding $newfav and that the save() method is called. Edited 2 hours ago by Inxentas Link to comment Share on other sites More sharing options...
Inxentas Posted 2 hours ago Author Share Posted 2 hours ago Nevermind, I screwed up! I now see that I was using the find method instead of the get method! Such a noobie mistake... this topic can be closed. I found the answer a few moments after posting. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now