Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Mar 2013 at 05:30 UTC
Updated:
29 Jul 2014 at 21:59 UTC
Jump to comment: Most recent
Comments
Comment #1
sunWOWZA. Worse:
The entity base table SQL columns are keyed by numeric indexes:
...which leaves me with this fancy hack:
Comment #2
plachI am not sure this has been discussed explicitly anywhere on d.o. but I think the plan is definitely to query entities based on field definitions. The following issues should help with this, but I guess completing the NG conversion should help too.
#1893772: Move entity-type specific storage logic into entity classes
#1498720: [meta] Make the entity storage system handle changes in the entity and field schema definitions
Comment #3
sunFWIW, further investigation showed that the corresponding
EntityStorageController::save()operations are still usingdrupal_write_record().drupal_write_record()completely relies onhook_schema().So the current code is actually inconsistent on two fronts:
1)
load()/buildQuery()uses the prepared SQL schema information, as prepared in entity info.2)
save()uses the literal information fromhook_schema().At minimum, only one of both, plz. ;-)
Comment #4
sunRelated: #1774104: Replace all trivial drupal_write_record() calls with db_merge()
Comment #5
Crell commentedI fully support moving Entity API to not rely on hook_schema() at all, and eliminating drupal_write_record() entirely.
Comment #6
das-peter commentedPossibly related:
#1498720: [meta] Make the entity storage system handle changes in the entity and field schema definitions
#1936382: Implement a sane storage default mapping
Comment #7
fagoI can second that. However, I'd not say it's evil if the DatabaseStorageController relies on hook_schema(). As the controller is tight to the database, it's fine for it. Still, I'd prefer to see it working solely from field definitions.
Comment #8
Paul B commentedIn DatabaseStorageController it's still using drupal_write_record() even though the class has a database field and starts a transaction in that field?
I guess I can't use that to store entities in a external database? Will this be fixed before Drupal 8 is finalized?
Comment #8.0
Paul B commentedUpdated issue summary.
Comment #9
sunComment #10
plachThis is actively being addressed in #2183231: Make ContentEntityDatabaseStorage generate static database schemas for content entities now. I guess we can call this fixed :)