Problem/Motivation

The codebase has calls to \Drupal\Core\Entity\EntityPublishedInterface::setPublished() with a parameter TRUE / FALSE. However, calling setPublished() with a parameter is deprecated since we have specialized methods available.

Issue: #2789315: Create EntityPublishedInterface and use for Node and Comment
Change record: https://www.drupal.org/node/2830201

Proposed resolution

  1. Replace setPublished(TRUE) with setPublished()
  2. Replace setPublished(FALSE) with setUnpublished()
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

idebr’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.49 KB

Attached patch:

  1. Replaces setPublished(TRUE) with setPublished()
  2. Replaces setPublished(FALSE) with setUnpublished()
thalles’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
187.09 KB

Works for me!

@see:

  • jonathan1055 committed 703b9a1 on 8.x-1.x authored by idebr
    Issue #3034805 by idebr, thalles: Replace the $published parameter which...
jonathan1055’s picture

Status: Reviewed & tested by the community » Fixed

Thank you. Committed.

jonathan1055’s picture

jonathan1055’s picture

Title: The $published parameter is deprecated since version 8.3.x and will be removed in 9.0.0 » Using setPublished() with a $published parameter is deprecated in 8.3
Issue summary: View changes

Fixed link to change record. The [#issuenumber] syntax only works for nodes in a project issue queue.

For the record this fix removed 39 deprecation failures from 13 tests: Token, ContentListAccess, Revisioning, Required, PastDates, NonEnabled, NodeAccess, Multilingual, FieldsDisplay, DeleteNode, DefaultTime, Basic, Api

Status: Fixed » Closed (fixed)

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