Description
Entity API allows entity types to support entitycache.module simply by adding the 'entity cache' => TRUE flag (conditionally) in hook_entity_info(). It then automatically retrieves the cached entities from the appropriate tables.
It does not however create the tables, each module needs to do that manually. Not doing that (in case of Profile2) leads to fatal errors, because non-existing database tables are being accessed.
Remaining tasks
Convince @fago that we should do this. When that is done, we can take the patch from #1336924-8: Default to use EntityCache if available, and create necessary cache bin tables as a starting point for this.
Related issues
#1387268: Profile2 entity cache table not created, causing PHP exceptions when saving/updating data
#1336924: Default to use EntityCache if available, and create necessary cache bin tables
Comment | File | Size | Author |
---|---|---|---|
#10 | 2017685_entity_create_entitycache_tables_10_interdiff.txt | 689 bytes | dasjo |
#10 | 2017685_entity_create_entitycache_tables_10.patch | 6.92 KB | dasjo |
#7 | d7_entity_cache.patch | 6.92 KB | fago |
#4 | 2017685_entity_create_entitycache_tables_4.patch | 6.13 KB | dasjo |
Comments
Comment #1
RaulMuroc CreditAttribution: RaulMuroc commentedAre you kidding man? If he is a maintainer or co-maintainer and has time then he should work on solving this point, we do not have to convince him because if this feature is not repaired basically this module is unuseful and can be deprecated. :S
It mas have automatic detection of required entities for cache because every site has different entities and we cannot "play rulette" that maybe breaks the page maybe not.
And of course, everyone interest shoudl help to achieve this goal!
Sorry for contundence, I'm :) anyway and hope you too.
Comment #2
fagoOk, had a look at this together with dasjo. https://drupal.org/node/1336924#comment-7415234 is a good starting point, however let's do:
Let's just use the helper + rely on the info 'module' key to match any of the installed modules. Yes we require devs to implement our own API ;-) Also document that entity cache support requires the module key to be specified at our entity_crud_hook_entity_info() 'entity cache' docs.
- hook_entity_info_alter() should be extended to disable "field-cache" automatically when entity cache is enabled and the module there.
- We should add all tables only when the module is there, and drop them if entitycache is uninstalled. Maybe best keep the install/uninstall logic in the .install file and call the helper from the hooks only to avoid cluttering the .module file further.
Comment #3
dasjowill post a patch soon
Comment #4
dasjohere's what i tested using the while module:
tables are created after entitycache install
tables are created after while install
tables are deleted after entitycache uninstall
tables are deleted after while while uninstall
Comment #5
dasjoComment #6
fagoPatch looks good and seems to work fine. Here a few minor remarks:
Summary is 1 char too long.
To early line break.
Missing space after foreach.
Comment #7
fagoFigured we miss hook_flush_caches() impl and should create tables on hook_enable().
Also addressed above remarks.
Comment #8
fagoPatch seems to work fine now - so this should be good to go. Further testers would be welcome!
Comment #9
fagoFigured this uses required_once with a relative path - which it shouldn't as it depends on the configured include path. Instead it should use module_load_install('entity');
Comment #10
dasjoimplemented suggested changes from #9
Comment #11
fagoThanks!
Comment #12
alexweber CreditAttribution: alexweber commentedAwesome, thanks for all the great work everyone! :)
Comment #13
Jody LynnSo, was this committed?
Comment #14
fagoThis seems to work fine, thus - committed.