Drupal\Core\Datetime\Entity\DateFormat class variables should not be accessed directly. Functions should be use to access the variable. For instance use getDescription() and setDescription($description) for the protected class variable description. For a boolean variable the getter function becomes isVariableName(). In object-oriented programming this is called encapsulation.
Remaining tasks
- Update the class variables and make them protected.
- Create getters and setters for frequently used get and set functionality.
- Update drupal to use the getters and setters instead of accessing variables directly.
- There are no tests required because the added functions are only getters and setters.
For more info over what should be done see the issue summary of #2016679: Expand Entity Type interfaces to provide methods, protect the properties.
Beta phase evaluation
Issue category | Bug because properties should not be public, API methods should not be allowed to be sidestepped. |
---|---|
Prioritized changes | Prioritized since it is a bug and it reduces fragility. |
Disruption | Somewhat disruptive for core as well as contributed and custom modules:
|
But impact will be greater than the disruption, so it is allowed in the beta.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2527076-1.patch | 598 bytes | daffie |
Comments
Comment #1
daffie CreditAttribution: daffie commentedSetting the two class variables that are not protected to protected. The variable are $id and $label.
Comment #2
vijaycs85Looks good. As the id() and label() are already defined in parent class, we can still get the value of these properties.
Comment #3
daffie CreditAttribution: daffie commentedTalked to catch on IRC and this issue can go in before 8.0. Only there is a change record necessary.
Comment #4
daffie CreditAttribution: daffie commentedChange record added. Back to RTBC.
Comment #5
alexpottGiven that this is the last set of public properties on a config entity that really shouldn't be I think that this is okay to proceed with at this point in the beta.
Committed dfa5621 and pushed to 8.0.x. Thanks!