Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Aug 2014 at 20:04 UTC
Updated:
19 Oct 2014 at 09:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
temoor commentedComment #2
Michael Hodge Jr commentedNot sure if this is accurate or not, but I applied the patch and grepped the code for these occurrences. Everything looks good except for finding one instance of entity_load_multiple('user_role').
It was located in the User.module file around line 1174. It's contained in the user_roles function. Is this a false positive? I'm assigning back to needs work, but if this should still be there, then feel free to set it to RTBC. The code for reference is below
Comment #3
temoor commentedThanks, @Michael Hodge Jr.
Removed remaining call in attached patch.
Comment #4
Michael Hodge Jr commentedMuch better. Thanks!
Comment #8
ohthehugemanatee commentedIs this a duplicate of #2322195: Replace all instances of user_load(), user_load_multiple(), entity_load('user') and entity_load_multiple('user') with static method calls?
Edit: no it isn't, I just skimmed over the word "role" in the title. Feelin' clever.
Comment #9
temoor commentedUsed User instead of Role class in user_role_revoke_permissions()
Comment #10
dawehnerWe still use user_role_load in
though you can easily replace this with
['\Drupal\user\Entity\Role', 'load']Comment #11
temoor commentedThanks, I should pay attention to d8 FAPI
Comment #14
estoyausenteRerolled
Comment #15
estoyausenteComment #17
estoyausenteComment #18
Mirroar commentedWe'll take a look at it, sprinting at DC Amsterdam.
Comment #19
Mirroar commentedOkay, so the reason the previous patch failed testing is because within UserRoleAdminTest.php calls to
entity_load('user_role', $id, TRUE)were replaced withRole::load($id). However, this does not reset the cache of loaded roles, unlike the old call.We added the code from entity_load to reset the cache before loading the Roles again. Not sure if this is the best way to reset the entity cache, but it seems to be working.
Comment #20
estoyausenteHi, @Mirroar, thank for the help. I debugged it and I haven't found the fail (F*** cache grrr).
It seems that now is correct. I think that someone with more experience have to review it, but I think that it's correct anyway.
Comment #21
Mirroar commentedIt seems the more widely used pattern here is something along the lines of
\Drupal::entityManager()->getStorage('user_role')->resetCache(array($role->id()));(user.module does something along those lines, and the Meta Issue also suggests this pattern). So I updated the patch to do that instead. Also adding an interdiff to #14 so the changes are easier to review.I've also run a grep for any of the functions mentioned in the issue title, and can't find any other references in the codebase. So as far as I know, we got all of them.
Comment #22
Mirroar commentedUpdated the issue summary
Comment #23
Mirroar commentedComment #24
mradcliffeThe changes in the interdiff make sense.
Reviewing the code in the entire patch. There does not seem to be any changes that do not correspond to the meta issue. I think this is RTBC if it passes tests.
We also need to create or update a change record related to this. Is this done on the meta issue?
Comment #25
Mirroar commentedSetting RTBC and updating the issue summary again. But I have no Idea how to create a change record for this, so this will need to be done by somebody else, probably.
Comment #26
Mirroar commentedComment #27
alexpottCommitted 331f287 and pushed to 8.0.x. Thanks!