Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293522

[meta] Deprecate __get/__set() on ContentEntityBase

$
0
0

Problem/Motivation

(Content) Entity API is hard to understand, one aspect of that is there there are multiple ways of doing things and a lot of magic.

This is an attempt to deprecate __get()/__set() on ContentEntityBase *only* (magic methods on field item and field item list classes is a different topic).

There are two different aspects to this:
a) Accessing fields, this can simply be deprecated 1:1 by using get()/set() instead, which only supports fields.
b) Non-field properties like ->original and other cruft, mostly leftovers. This is tougher, for official things like ->original we should add a method, for random stuff we could consider some kind of temporary storage, there is an issue for that that I would need to dig out.

(#1977266: Fix ContentEntityBase::__get() to not return by reference, was only about the by-reference return, this is about deprecating it entirely.)

Steps to reproduce

Proposed resolution

Remaining tasks

Prerequisites/Blockers

* #2839195: Add a method to access the original property / #1480696: Move $entity->original to a separate hook argument
* #2896474: Provide an API to temporarily associate data with an entity

User interface changes

API changes

This will have a huge impact on mostly custom code, accessing fields through magic methods is very common.

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>