------ ----------------------------------------------------------------------
Line src/Controller/ProductReviewController.php
------ ----------------------------------------------------------------------
57 Call to deprecated function drupal_set_message():
in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
------ ----------------------------------------------------------------------

------ ----------------------------------------------------------------------
Line src/Form/ProductReviewForm.php
------ ----------------------------------------------------------------------
139 Call to deprecated function drupal_set_message():
in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
------ ----------------------------------------------------------------------

------ ----------------------------------------------------------------------
Line src/Form/ProductReviewTypeForm.php
------ ----------------------------------------------------------------------
121 Call to deprecated function drupal_set_message():
in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
------ ----------------------------------------------------------------------

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deeksha B created an issue. See original summary.

Deeksha B’s picture

Status: Active » Needs review
FileSize
2.12 KB

Please review the patch.

agoradesign’s picture

Status: Needs review » Needs work

thx.. although it looks good, I'd want to see a small change: please use "addStatus" instead of "addMessage"... although the latter one defaults to status type, it is far more readable to use the dedicated method. That's why I'm preferring the dedicated ones

Deeksha B’s picture

Status: Needs work » Needs review
FileSize
2.11 KB

I have updated the changes, Please review.

agoradesign’s picture

Status: Needs review » Needs work

Sorry, there's another mistake I've just recognized. And it's a really important one. You are directly accessing the $this->messenger property, but this is not guaranteed to be set. The forms as well as the controller are using the MessengerTrait and never use the explicit setter, which is ok, but in order to be always safe to get a messenger instance, you must rather call $this->messenger() than accesing $this->messenger. This two brackets are a small but very important difference here!

Deeksha B’s picture

Status: Needs work » Needs review
FileSize
2.12 KB

Sorry, That was a mistake from my end, I have updated the changes.

  • agoradesign committed 18cec83 on 8.x-1.x authored by Deeksha B
    Issue #3098614 by Deeksha B, agoradesign: Use new Messenger service...
agoradesign’s picture

Status: Needs review » Fixed

That's fine now! Thanks :)

Status: Fixed » Closed (fixed)

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