Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
field system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Mar 2013 at 14:33 UTC
Updated:
29 Jul 2014 at 21:58 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #0.0
swentel commentedAdd screenshot
Comment #1
chx commentedIt's not confused at all.
->condition('router_path', $paths, 'NOT IN')inmenu.inccauses$field = field_info_field($specifier);to fire inDrupal\field_sql_storage\Entity\Tables::addFieldtrying to figure out whetherrouter_pathis a customizable (field API) field or not. Why is this a problem?Comment #2
swentel commentedOh ok, yeah, didn't look that far. I guess the annoying part is that all fields are going to be loaded into memory in light of the CMI conversion on pages where we don't actually need them. I guess we can/should make field_info_field() smarter then.
Comment #3
yched commentedSo yeah, the current use of field_info_field() within EFQ is a perf problem, really doesn't play well with the FieldInfo cache strategy, and this shows badly with "Field API -> CMI" : #1735118-149: Convert Field API to CMI
What EFQ really does is "is that $name a Field API field ?". Only if yes, it needs the actual $field.
But the 1st question is "does this field exist ?", and for that it should use field_info_field_map().
Comment #5
swentel commentedtagging
Comment #6
marcingy commentedHopefully this is along the right lines. Entity query tests still pass locally.
Comment #8
marcingy commentedNew version this adds a lightweight mapper to get fields by id not sure if this is needed by given the context it seems to make sense.
Comment #9
marcingy commentedDoxygen was wrong in last patch.
Comment #10
yched commentedThanks for tackling this, @marcingy !
I'm not sure the part about ids is really needed.
The problematic part of the addField() method is loading a field definition (thus hitting config) just to check whether some string is a field name or not (in which case we consider it's an entity property).
I.e. those lines in HEAD :
I'd think the case when $specifier is "id:[something]", that is dealt with be the lines just above that snippet, is not ambiguous and "[something]" is then *always* a field ID. Then, no need to check a field map, calling field_info_field_by_id() is fine.
This could use some confirmation from @chx, though, cause this 'id:' syntax doesn't seem to be documented in Drupal\Core\Entity\QueryInterface ?
Other approach : entity properties are defined in code, and field API fields are defined in config. So it should be much faster to check if something is an entity property first, and only then check if it's a field ?
Comment #11
yched commentedRe-titling.
Comment #12
chx commentedThe id: is only for purge purposes and so is not documented. The whole field purge needs a new approach...
Comment #13
chx commentedI re-read the issue a few times and wrote an entirely new patch, using marcingy's patch as inspiration only.
Comment #14
berdirI can confirm that field_read_field() is only called for actual fields with this patch. Not sure if it should be called at all, I guess direct access to a certain field isn't cached?
Given that, not sure if I can RTBC this patch like that, today is the big day for Field API so swentel will very likely show up during the day and can hopefully answer that question.
Comment #15
yched commented#13 looks just fine, and #1735118: Convert Field API to CMI doesn't touch this file at all, so this shouldn't conflict.
Thanks @chx !
Comment #16
alexpottCommitted e0a111a and pushed to 8.x. Thanks!
Comment #17.0
(not verified) commentedUpdated issue summary.