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

Refactor the entity system to be evented

$
0
0

Problem/Motivation

It was decided that Drupal 8 will rely heavily on OOP. While the entity system does this, the only way to interact with is via procedural code. This patch intends to remove the necessity to write procedural code and opens up the possibility to make (much more) of the entity code unit testable. Other problems include a total mixup of storage independent logic with the actual storage, for example calculating the comment thread vs storing the comment thread. There are no interfaces for the storage controllers because it is entirely unclear what the specific storage needs are. The number of hooks available were totally unwieldy as well (quick, does hook_field_load fire before or after hook_field_attach_load? What about hook_field_insert and hook_field_attach_insert? Where does hook_entity_load enter into the picture?).

Proposed resolution

Hooks are out. Events are in. Storage controllers thin down and get an interface. The logic moves into a StorageSubscriber. Entity hook implementations move into an EntitySubscriber.

Remaining tasks

The patch is not yet green. It is being worked on in http://drupal.org/sandbox/chx/1857558 entitystorage branch.

User interface changes

No user interface changes.

API changes

All entity hooks die -- from hook_entity_load to hook_user_delete, all. Field attach storage hooks die. Field storage callbacks die. Entity events are born.

#1497374: Switch from Field-based storage to Entity-based storage
#1893772: Split Entity StorageController into Storage + CRUDController


Viewing all articles
Browse latest Browse all 297447

Trending Articles



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