Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Postponed on
#2134513: [policy, no patch] Trait strategy
Problem/Motivation
ControllerBase is currently an abstract base class. This is ok, but stops any controller inheriting anything else, unless they directly extend controller base.
Proposed resolution
Make it a trait!
Remaining tasks
User interface changes
None
API changes
No ControllerBase abstract class anymore.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff-2206917-8.txt | 749 bytes | damiankloip |
#8 | 2206917-8.patch | 47.9 KB | damiankloip |
Comments
Comment #1
damiankloip CreditAttribution: damiankloip commentedPatch to follow.
Comment #2
damiankloip CreditAttribution: damiankloip commentedLet's see what fails.
Comment #4
damiankloip CreditAttribution: damiankloip commentedWhoops, a syntax error is always good.
Comment #6
damiankloip CreditAttribution: damiankloip commentedLet's try this.
Comment #7
dawehnerWe can haz getObjectFromTrait?
Comment #8
damiankloip CreditAttribution: damiankloip commentedYes, yes you can haz that.
Comment #9
dawehnerThank yoou!
Comment #10
tstoecklerThis (and all others) violate our coding standards. There should be a blank line before the use.
More importantly, however, I'm not sure this should go in as long as we haven't figured out #2134513: [policy, no patch] Trait strategy. Especially because #2079797: Provide a trait for $this->t() and $this->formatPlural() would duplicate part of the ControllerBase trait.
I.e. I think it would more sense to decompose the *parts* of ControllerBase into separate traits so people can pick and choose which ones they actually need.
Comment #11
ParisLiakos CreditAttribution: ParisLiakos commented+1 on #10
see point 2 in #2134513: [policy, no patch] Trait strategy
ControllerBase should be a collection of many small traits, each one targeted to a specific thing
Comment #12
ParisLiakos CreditAttribution: ParisLiakos commentedComment #13
damiankloip CreditAttribution: damiankloip commentedOk whatever. I'm not going to argue. You run a risk of making things confusing for people if they have to include too many traits.
Closing this then?
Comment #14
ParisLiakos CreditAttribution: ParisLiakos commentedi dont think it is confusing. It is like use statements. you need something? use it
or extend ControllerBase and dont care at all.
At least postponed though rather than closed
Comment #15
YesCT CreditAttribution: YesCT commentedComment #16
mgiffordComment #17
YesCT CreditAttribution: YesCT commented