timber
timber copied to clipboard
2873 bug cannot use timberpostfactory when extending post class as the method is private
Related:
- #2873
Issue
The Timber\Post::factory() is private and thus cannot be overwritten. So there was no way to alter the query to get the children.
Solution
Added two new ways to alter the query:
- added a filter to change the arguments
- Add a new functionality to overload the children() parameter with query arguments.
I came up with the second approach later because that might be easier for most people. You could just change the arguments in your children
call or make a separate children method in your custom class that calls the parent::children method with these additional arguments.
Impact
No negative impact since loading the argument with a string or a non-indexed array still works.
Usage Changes
No
Considerations
Maybe one of these methods is enough. Not sure if adding the full argument list is a bit too much for this method.
Testing
Yes! First unit test I've ever written 👯