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.
Part of meta-issue #1856630: [Change notice] [META] Rename Views methods to core standards
Comment | File | Size | Author |
---|---|---|---|
#6 | views_rename_getFieldAlias-2002912-6.patch | 1.22 KB | markie |
#1 | rename_getFieldAlias-2002912-1.patch | 1.11 KB | markie |
Comments
Comment #1
markie CreditAttribution: markie commentedpatched
Comment #3
oenie CreditAttribution: oenie commented#1: rename_getFieldAlias-2002912-1.patch queued for re-testing.
Comment #4
oenie CreditAttribution: oenie commentedPatch queued for a retest, apart from problem below it should be in order.
Add protected access modifier in front of the function to adher to the new OOP standards.
Comment #5
oenie CreditAttribution: oenie commentedComment #6
markie CreditAttribution: markie commentedprotected access added, but can you tell me why that function should be protected?
Comment #7
oenie CreditAttribution: oenie commentedSure. I'm going to assume you want to know the difference between the two ?
(You're a longtime Drupaller, so i'm not sure this is the right assumption, but anyway :))
Protected is used when methods are for internal use of an object and its subclasses.
In this case, you can see that the only code that calls it is $this->getFieldAlias.
Which would mean protected is enough for access.
This in contrast to code where you would see things like:
$this->query->getFieldAlias(...)
Here another class is calling the method on a different class. If you would write protected there, it would field a problem because the method is not visible to it. Public would be needed there.
Although it's not sure this mehod will always be called internally, i would always choose for the less visible one.
Unless of course it would be something more obvious (which this one doesn't feel like to me)
Comment #8
markie CreditAttribution: markie commentedHey thanks for the reply. I just wanted to hear your reasoning. Glad you went into detail.
Does everything look good?
Comment #9
heddnApplies cleanly and no mentions of get_field_alias any more. Passed testbot.
Comment #10
alexpottCommitted 5c63406 and pushed to 8.x. Thanks!