Inherits beta evaluation from parent issue: #2367749: Remove usage of deprecated UrlGeneratorInterface::generateFromPath()

Problem/Motivation

UrlGeneratorInterface::generateFromPath() is deprecated for removal before Drupal 8.0.0 release.

All usages in core/modules/* should be removed, except those in the system module which are being handled in #2558189: Remove usage of deprecated UrlGeneratorInterface::generateFromPath() in system module

Proposed resolution

Fix by changing the method call to generateFromRoute() with a route name and parameters

Remaining tasks

User interface changes

n/a

API changes

n/a

Contributor tasks needed
Task Novice task? Contributor instructions Complete?

Comments

ianthomas_uk created an issue. See original summary.

martins.kajins’s picture

Status: Active » Needs review
StatusFileSize
new11.11 KB

Changed method to generateFromRoute()

Status: Needs review » Needs work

The last submitted patch, 2: core-2566751-remove-generateFromPath-2.patch, failed testing.

The last submitted patch, 2: core-2566751-remove-generateFromPath-2.patch, failed testing.

mandar.harkare’s picture

Status: Needs work » Needs review
StatusFileSize
new3.65 KB

Rolling the patch.

dawehner’s picture

Status: Needs review » Needs work

Ha, well, they are two totally different methods, so just replacing them doesn't work.

The last submitted patch, 5: 2566751-replace-generateFromPath-5.patch, failed testing.

The last submitted patch, 5: 2566751-replace-generateFromPath-5.patch, failed testing.

martins.kajins’s picture

$url = \Drupal::service('path.validator')->getUrlIfValid($path);

I'm considering using this function to convert paths into urls.

snehi’s picture

review this one.

martins.kajins’s picture

Status: Needs work » Needs review

@snehi when you post a patch, you should set status to Needs review.

Status: Needs review » Needs work

The last submitted patch, 10: D8-core-replace_generate_path_with_route-2566751-10.patch, failed testing.

martins.kajins’s picture

@snehi i can not apply patch. Maybe problem is here.

diff --git a/core/modules/help/tests/modules/help_test/src/SupernovaGenerator.php b/core/modules/help/tests/modules/help_test/src/SupernovaGenerator.php
index 635ecaa..eaa92ce 100644
--- a/core/modules/help/tests/modules/help_test/src/SupernovaGenerator.php
+++ b/core/modules/help/tests/modules/help_test/src/SupernovaGenerator.php
@@ -39,7 +39,7 @@ public function generate($name, $parameters = array(), $referenceType = self::AB
   /**
    * {@inheritdoc}
    */
-  public function generateFromPath($path = NULL, $options = array(), $collect_bubbleable_metadata = FALSE) {
+  public function generateFromRoute($path = NULL, $options = array(), $collect_bubbleable_metadata = FALSE) {
     throw new \Exception();
   }

The last submitted patch, 10: D8-core-replace_generate_path_with_route-2566751-10.patch, failed testing.

deepakaryan1988’s picture

Assigned: Unassigned » deepakaryan1988
deepakaryan1988’s picture

Assigned: deepakaryan1988 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new4.67 KB

Status: Needs review » Needs work

The last submitted patch, 16: D8-core-replace_generate_path_with_route-2566751-16.patch, failed testing.

The last submitted patch, 16: D8-core-replace_generate_path_with_route-2566751-16.patch, failed testing.

duaelfr’s picture

Category: Bug report » Task
Issue tags: -Novice

IMHO that issue cannot be considered as a "Novice" issue. What has to be done is not easy or clear enough for new contributors.

pwolanin’s picture

Title: Remove usage of deprecated UrlGeneratorInterface::generateFromPath() in system module » Remove usage of deprecated UrlGeneratorInterface::generateFromPath() in GotoAction and web tests
pwolanin’s picture

Title: Remove usage of deprecated UrlGeneratorInterface::generateFromPath() in GotoAction and web tests » Remove usage of deprecated UrlGeneratorInterface::generateFromPath() in modules other than system
pwolanin’s picture

Status: Needs work » Closed (duplicate)

The last submitted patch, 10: D8-core-replace_generate_path_with_route-2566751-10.patch, failed testing.