Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff-2723611-20-24.txt | 420 bytes | Sagar Ramgade |
#24 | 2723611-24.patch | 3.31 KB | Sagar Ramgade |
#20 | interdiff-2723611-14-20.txt | 731 bytes | Sagar Ramgade |
#20 | 2723611-20.patch | 3.43 KB | Sagar Ramgade |
#14 | interdiff-2723611-10-14.txt | 770 bytes | ashishdalvi |
Comments
Comment #2
marvin_B8 CreditAttribution: marvin_B8 as a volunteer and at comm-press commentedComment #3
Mile23The patch applies and it handles all useages of entity_load*'node', but there's one thing:
Get
$storage
once at the top of the method, and then use it in all the different places, including replacingNode::load()
.Comment #4
gaurav.pahuja CreditAttribution: gaurav.pahuja as a volunteer and at Publicis Sapient commentedDone.
Please check.
Comment #5
valthebaldGood progress! I have some small notes though:
1.
$storage variable is used only once, can be just
2. In NodeFormSaveChangedTimeTest.php
I think added empty lines reduce readability, not increase it
Comment #6
Sonal.Sangale CreditAttribution: Sonal.Sangale at Blisstering Solutions commentedComment #7
Sonal.Sangale CreditAttribution: Sonal.Sangale at Blisstering Solutions commentedAdded suggested changes.
Comment #8
Mile23Right, that's what I was referring to in #3.
Node::load(1)
; can be replaced with$storage->load(1)
.So: Replace
Node::load(1)
with a call to$storage->load(1)
. In order to do that, get$storage
at the top of the function instead of the middle.The reason to do this is:
Node::load()
gets the storage service from\Drupal
, which is generally bad for tests. In other circumstances it doesn't matter so much, and if we weren't already getting the storage service I wouldn't bring it up.Comment #9
gaurav.pahuja CreditAttribution: gaurav.pahuja as a volunteer and at Publicis Sapient commentedComment #10
ashishdalviHi Mile23,
Worked on suggestion mentioned. Please review.
Comment #11
ashishdalviSorry, Didn't noticed previously added patch.
Comment #12
valthebaldThere is no such thing as Node::loadByProperties() - tests pass only because this call is in comment.
This should be \Drupal::entityTypeManager()->getStorage('node')->loadByProperties()
Comment #13
ashishdalviComment #14
ashishdalviWorked on suggested changes.
Comment #15
ashishdalviComment #16
valthebaldPatch #14 contains all recommendations that were given, and there are no more occurences of entity_load*'node'
Comment #17
catchCommitted/pushed to 8.2.x, thanks!
Comment #18
xjmSo something went strange with this and it is not in HEAD. I think it (or part of it) got committed along with #2723589: Remove entity_load* usage for filter_format entity type, and then HEAD broke.
Setting this issue back to RTBC and sending for a retest.
Comment #19
xjmAlright, I took a look at the actual patch here now that we know it doesn't break HEAD when it's applied as a whole. ;)
This appears to be changing the logic of the test. It's no longer ensuring the entity is reloaded with the cache reset after the
save()
call, which seems to me to be the point of the test.Comment #20
Sagar Ramgade CreditAttribution: Sagar Ramgade as a volunteer and at Trigyn Technologies Ltd commentedPatch attached addresses #19 by @xjm.
Comment #21
Sagar Ramgade CreditAttribution: Sagar Ramgade as a volunteer and at Trigyn Technologies Ltd commentedComment #22
naveenvalechaare we using this Node class ? if not remove it.
Comment #23
valthebaldSecond to what @naveenvalecha said
Comment #24
Sagar Ramgade CreditAttribution: Sagar Ramgade as a volunteer and at Trigyn Technologies Ltd commentedThank you Naveen for catching that, interdiff and patch attached.
Comment #25
valthebaldSwitching to RTBC again
Comment #26
alexpottCommitted fc189a4 and pushed to 8.2.x. Thanks!