Skip to content

Comments

Make extend() method usable with behaviors.#113

Closed
mjauvin wants to merge 5 commits intodevelopfrom
extend-with-behaviors
Closed

Make extend() method usable with behaviors.#113
mjauvin wants to merge 5 commits intodevelopfrom
extend-with-behaviors

Conversation

@mjauvin
Copy link
Member

@mjauvin mjauvin commented Sep 8, 2022

Replaces #112

Model::extend(function ($model) {
    $model->behaviorMethodAvailable();
}, after: true);

Related: wintercms/docs#98

@bennothommo
Copy link
Member

@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 :)

@mjauvin
Copy link
Member Author

mjauvin commented Sep 11, 2022

So, who's in favor of merging this? Or something similar but through a seperate dedicated method ( e.g. extendPostBehavior() )

@mjauvin mjauvin added this to the 1.2.2 milestone Sep 12, 2022
@LukeTowers
Copy link
Member

@mjauvin are you needing this in 1.2.1 or are you fine with waiting for 1.2.2?

@mjauvin
Copy link
Member Author

mjauvin commented Sep 13, 2022

@LukeTowers I'm fine to wait for 1.2.2, which is why I moved it there.

@mjauvin
Copy link
Member Author

mjauvin commented Oct 7, 2022

Should I create a PR to the docs repo documenting this?

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

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.

@bennothommo
Copy link
Member

bennothommo commented Dec 25, 2022

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.

@LukeTowers LukeTowers self-requested a review December 26, 2022 08:24
@mjauvin
Copy link
Member Author

mjauvin commented Feb 18, 2023

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?

@mjauvin
Copy link
Member Author

mjauvin commented Feb 18, 2023

Close in favor of #134.

@mjauvin mjauvin closed this Feb 18, 2023
@mjauvin mjauvin deleted the extend-with-behaviors branch February 18, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants