New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.x] Update child URIs when parent slug changes #9454
[4.x] Update child URIs when parent slug changes #9454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it might be better for this logic to live in the Entry@save
method instead so it's next to the rest of the save logic?
Also, with it being a listener on the EntrySaved
event, it won't trigger if someone's doing $entry->saveQuietly()
.
Oh yeah good point. I only did it like that because I was copying the other Shall I change it? |
I think its okay where it is 👌
There's no way at the moment, but should be once #5502 gets implemented. |
Since #5502 is pretty close to being merged, I'll mark this as a draft until we implement only doing this when the slug changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the isDirty PR is ready, use it to make sure that all of this only happens if the slug has changed.
Cool, will do. |
Done |
Duncan was right. Not sure why I was okay with leaving it as an event. Anyway, I updated it for you. Thanks both! |
Fixes #9445
This PR implements a new listener that updates the URI index for all child pages whenever the parent page is updated.
It should probably only run if the slug has actually changed, but I'm not sure if there's a way to check that in an EntrySaved listener?I couldn't figure out the right way or place to do the test, if you can point me in the right direction I'll add that in.