As a half way house between deprecating entity procedural functions, maybe we could have some convenience methods on the entity manager as shortcuts for creating and loading entities?
So :
drupal_container()->get('plugin.manager.entity')->getStorageController('user')->create(array('value' => 'dfdfd'));
would become :
drupal_container()->get('plugin.manager.entity')->createEntity('user', array('value' => 'dfdfd'));
I'm not going to do any more on this for now, as the idea might just get shot down.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1931894-2.patch | 5.38 KB | damiankloip |
| #2 | interdiff-1931894-2.txt | 3.67 KB | damiankloip |
| d8.entity-manager-methods.patch | 2.58 KB | damiankloip |
Comments
Comment #0.0
damiankloip commentedcode block
Comment #1
dawehnerWe probably want loadEntity and loadEntities.
Comment #2
damiankloip commentedComment #3
dawehnerNice, thought we should be clear that it's still encouraged to use the storage controller directly.
Comment #4
alexpottDiscussed this with @timplunkett and since #1893772: Move entity-type specific storage logic into entity classes and the improved typehints on storage controllers this would be a step back on properly injected code.
So... marking as "won't fix"... if @damiankloip or @dawehner feel this is wrong... re-open and explain... if we decide to kill all the entity_* wrappers then this will probably be a good compromise...
Comment #5
damiankloip commentedI would have at least postponed it on that basis, for review before release. I was under the impression that the entity_* wrappers were going, so IMO we need something like this instead.
Comment #6
andypostIt's open up again in #1867228: Make EntityTypeManager provide an entity factory
Comment #6.0
andypostUpdated issue summary.