Closed (fixed)
Project:
Drupal core
Version:
8.1.x-dev
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
28 Dec 2015 at 20:31 UTC
Updated:
2 Mar 2016 at 06:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mac_weber commentedComment #4
mac_weber commentedFixed class aliasing
Comment #5
naveenvalechapatch does not apply anymore. Rerolled the patch.
Although it does not contain my code and it looks good to go, So RTBC it
Comment #6
alexpottA few
entity_create('file');are missing - for example in core/modules/editor/src/Tests/EditorFileUsageTest.phpComment #7
naveenvalechaReplaced all the stuff.
Few more findings that I did
Used $this->container->get('entity_type.manager')->getStorage('file')->create($field_values); in Tests b/c we used the static functions before DI was not possible in procedural code.
Comment #8
mile23Looks like the interdiff is a repeat of the patch, and ends in .patch, so I'm reviewing https://www.drupal.org/files/issues/2641588-7.patch
I'm split down the middle on whether to use the entity type service or
Entity::create()in these issues. So here's my review:The patch applies and gets all the occurrences but one remaining in
FeedsEnclosure.php.In places like this, if you're explicitly using the service to generate the entity more than once, you should get a reference to the entity storage once, and then call
create()on that multiple times.It's obvious in this place in the patch that this is the solution, since this bit is uninterrupted in the patch. But it might also be like this in other places, too that aren't so obvious.
If we make this change so that we get the service once and then generate multiple entities, *or* if we use
Entity::create()instead, I'll RTBC. Just so you know. :-) I think the emphasis is on deprecatingentity_load()rather than analyzing the code.Also: Restarting the test.
Comment #9
naveenvalecha#8, Agreed we should use the static method for consistency over all places. EntityType::create()
As per discussion with about #7 in one of the followup issue, we are now sticking with the static method in tests as well.
hiding #7 patch
Resetting test for #5
Comment #11
mile23Looks like #5 failed testing. I just tried to patch it and it doesn't apply.
Comment #12
heykarthikwithuworking on this.
Comment #13
heykarthikwithuComment #14
legovaerPatch applies, successfully replaces entity_create('file').
RTBC.
Comment #15
catchNeeds a re-roll.
Comment #16
naveenvalechaComment #17
xaiwant commentedComment #18
dimaro commentedRerolled #13
Comment #19
mile23Missed one:
Comment #20
dimaro commented@Mile23 I haven't been able to locate the file you indicate and I made a recursive search to replace entity_create('file') and I haven't found any new.
Please could you check again?
Comment #21
naveenvalechaI checked with my IDE and its fine, there's no occurance left. Thanks!
#19, I think its the feeds module FeedsEnclosure.php http://cgit.drupalcode.org/feeds/tree/src/FeedsEnclosure.php?h=8.x-3.x#n118
Comment #22
catchNeeds another re-roll...
Comment #23
dimaro commentedRerolled #18.
Comment #24
mile23Thanks for the reroll.
Patch applies, and my IDE says it deals with all occurrences of entity_create('file
RTBC.
Comment #25
catchCommitted/pushed to 8.1.x, thanks!