Coloquent
Coloquent copied to clipboard
Allow overriding methods or properties
Hi!
It would be great to have the possibility to override more methods of the tool, essentially in Model.
This will require changing their visibility from private
to protected
.
For example, I would like to override the get
method for Models and builders where I don't have pagination, but the query
of the builder is a private attribute.
@DavidDuwaer It's a very good idea, i think the methods and props should be all protected to allow overrinding.
Can i do a PR for this?
I think this is an easy way to allow use for many more edge cases. Most importantly I think it spurs organic growth of good inventions/additions that can later be added into the library itself.
That said, these methods being overridable should not expand the API's "surface" that is required to maintain backward compatibility going onward. In other words, overriding the internals of the API by users of the library should be done at own risk. So we should state that clearly in those methods' docs. Then it's fine by me!
@DavidDuwaer I understand. In every case, methods which are public or protected should be more documented to understand the impacts of changing their behavior. I leave this issue open since @filipedtristao proposed a PR.