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.
Problem/Motivation
EntityInterface->getSystemPath()
is deprecated and will be removed on Drupal 8.0.x
Proposed resolution
Replace all usage with EntityInterface->urlInfo()
Remove all implementations and definition from interface
Remaining tasks
create patch
fix tests
User interface changes
no
API changes
Removal of EntityInterface->getSystemPath()
and all implementations
Beta phase evaluation
Issue category | Task because this issue does not fix anything that's broken, other than deprecation. |
---|---|
Issue priority | Normal because it's not a pressing issue. |
Prioritized changes | Prioritized because the main goal of this issue is removing code already deprecated for 8.0.0 |
Disruption | Disruptive for contributed and custom modules which still use the deprecated method EntityInterface->getSystemPath() |
Comment | File | Size | Author |
---|---|---|---|
#15 | 2476059-remove-getsystempath-15.patch | 6.06 KB | willzyx |
#15 | interdiff-13-15.txt | 1.15 KB | willzyx |
#13 | 2476059-remove-getsystempath-13.patch | 6.09 KB | willzyx |
#11 | 2476059-remove-getsystempath-11.patch | 5.26 KB | yarik.lutsiuk |
#11 | interdiff.txt | 5.26 KB | yarik.lutsiuk |
Comments
Comment #1
andypostComment #2
BerdirThere is exactly one call to it in core. And that's the test for that method.
There's no need to remove that separately.
Comment #3
mathankumarc CreditAttribution: mathankumarc commentedComment #4
tadityar CreditAttribution: tadityar commentedFound another one in CommentTranslationUITest (?)
Comment #6
andypostUse
$entity->urlInfo()
it's not static method
Comment #7
tadityar CreditAttribution: tadityar commentedComment #9
mathankumarc CreditAttribution: mathankumarc commentedJust changing to urlInfo makes that particular test case to fail. Need to troubleshoot to get more info about this test case execution
Comment #10
BerdirurlInfo returns an object, so you should rename it to $url.
The problem is that you can't pass in the language to drupalPostForm() like the code below is doing if you have an object, instead you need to pass it to urlInfo().
But that means you need to move the code inside the foreach loop, so you get a different object for each language.
As I said, this is the test for the function. Removing the test without removing the method is wrong IMHO. That said, I don't think we need an issue to fix a single call, we can probably just remove it all here?
Comment #11
yarik.lutsiuk CreditAttribution: yarik.lutsiuk at Skilld commentedremoved usage and function with test
Comment #13
willzyx CreditAttribution: willzyx commentedComment #14
BerdirYou can pass a UrlInfo() object to drupalPostForm(), that should eliminate the need for the absolute option and ->toString(), rename $path to $url then.
Comment #15
willzyx CreditAttribution: willzyx commentedComment #16
BerdirPatch looks good to me now. I'm not aware of any contrib modules still using this, so we should be pretty safe.
Issue title needs to be updated to reflect that we are actually removing the method here.
And we need a beta evaluation and prepare a change record. The only mention that I can find is the introduction of the method in https://www.drupal.org/list-changes/published?keywords_description=getSy....
Once this is committed, we should also review that change record and update it for current standards.
Comment #17
willzyx CreditAttribution: willzyx commentedAdded beta evaluation and changed title
Comment #18
BerdirOk, this was deprecated a long time ago, so I think it's OK to remove it?
As mentioned above, couldn't find any contrib usages anyway and it was only introduced a year ago...
I don't think we need a new change record for this as mentioned, we can update the existing one and just remove this part, or if we want to we can say that if you really, really need the system path (path system still does for example), you can use $entity->urlInfo()->getInternalPath().
Comment #19
dawehner+1 to the RTBC
Comment #20
alexpottCommitted c31fec2 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Comment #22
Maouna CreditAttribution: Maouna at bio.logis Genetic Information Management GmbH commentedMy patch in https://www.drupal.org/node/2497247 failed because of
Fatal error: Call to undefined method Drupal\block\Entity\Block::getSystemPath() in /var/lib/drupaltestbot/sites/default/files/checkout/sites/default/modules/token/src/Tests/TokenBlockTest.php on line 54
Can you please include that, too? Thanks!
Comment #23
Berdirtoken is a contrib module and already has a patch.