Make extend() method usable with behaviors.
Replaces #112
Model::extend(function ($model) {
$model->behaviorMethodAvailable();
}, after: true);
Related: https://github.com/wintercms/docs/pull/98
@mjauvin I've tweaked the property names and did some clean up of the Extendable trait. Feel free to revert if you disagree with it all :)
So, who's in favor of merging this? Or something similar but through a seperate dedicated method ( e.g. extendPostBehavior() )
@mjauvin are you needing this in 1.2.1 or are you fine with waiting for 1.2.2?
@LukeTowers I'm fine to wait for 1.2.2, which is why I moved it there.
Should I create a PR to the docs repo documenting this?
This pull request will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this is still being worked on, please respond and we will re-open this pull request. If this pull request is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
Just to note - this PR could be implemented via https://github.com/wintercms/storm/pull/134 instead if we wanted to go down that route.
@mjauvin's use case could be simply extending a particular instance of the model locally via $model->extend(), which happens after instantiation and so other methods created by behaviors or other extensions would already be available.
Just to note - this PR could be implemented via #134 instead if we wanted to go down that route.
@mjauvin's use case could be simply extending a particular instance of the model locally via
$model->extend(), which happens after instantiation and so other methods created by behaviors or other extensions would already be available.
@bennothommo are you saying I could do:
MyModel::extend(function () {
$this->extend(function () {
$this->behaviorMethodAvailable();
});
}, true);
And that $this->behaviorMethodAvailbale() call would work?
Close in favor of #134.