EntityInterface::link() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0
Change record: https://www.drupal.org/node/2614344

The code to change is in scheduler_api_test/scheduler_api_test.module which is covered by the SchedulerApiTest test.

The deprecation warnings are not generated in core 8.6, but they are at 8.7, although suppressed on d.o. The output from TravisCI testing is:

Remaining deprecation notices (4)
  4x: EntityInterface::link() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toLink() instead. Note, the default relationship for configuration entities changes from 'edit-form' to 'canonical'. See https://www.drupal.org/node/2614344

    2x in SchedulerApiTest::testAllowedUnpublishing from Drupal\Tests\scheduler\Functional
    2x in SchedulerApiTest::testAllowedPublishing from Drupal\Tests\scheduler\Functional

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

idebr’s picture

Status: Active » Needs review
StatusFileSize
new2.63 KB

Attached patch implements the following changes:

  1. Replaced the usages of $node->link() with $node->toLink()->toString()
  2. Added NodeInterface type casting to hook_scheduler_allow_publishing()/ scheduler_api_test_scheduler_allow_unpublishing() in line with the documentation in scheduler.api.php
jonathan1055’s picture

Issue summary: View changes

This looks good, thanks for the patch.

  • jonathan1055 committed 3da1dfd on 8.x-1.x authored by idebr
    Issue #3035911 by idebr: EntityInterface::link() is deprecated, replace...
jonathan1055’s picture

Status: Needs review » Fixed

Fixed and committed.

We should now get a clean pass of tests without any deprecation warnings on #3035104: [meta] Remove deprecated code flagged by @trigger_error messages for Drupal 9 compatibility at core 8.7 (although I have just noticed that drupal 8.8 is available to test against)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.