Call to a member function load() on null in Drupal\opigno_messaging\Services\OpignoPrivateMessageService->getFirstThreadForUser()

Created on 9 October 2024, 2 months ago

Problem/Motivation

Error: Call to a member function load() on null in Drupal\opigno_messaging\Services\OpignoPrivateMessageService->getFirstThreadForUser() (line 38 of C:\xampp\htdocs\TLMS\opigno-composer\web\modules\contrib\opigno_messaging\src\Services\OpignoPrivateMessageService.php).

Steps to reproduce

Upgrade opigno_lms to 3.2.7 from 3.1.0 and access URL /private-messages in the browser and see the above error.

Proposed resolution

Used unknown method $this->pmThreadManager->load() at modules\contrib\opigno_messaging\src\Services\OpignoPrivateMessageService.php under method getFirstThreadForUser(). Use this $this->entityTypeManager->getStorage('private_message_thread')->load() instead of $this->pmThreadManager->load()

🐛 Bug report
Status

Needs work

Version

3.2

Component

Code

Created by

🇮🇳India kanchamk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kanchamk
  • 🇮🇳India kanchamk

    Patch included.

  • Status changed to Downport 2 months ago
  • 🇺🇸United States pearl.liang

    Hi kanchamk

    I am also installing Opigno 3.2.7. The above patch solves the first error message caused by visiting /private-message:

    Error: Call to a member function load() on null in Drupal\opigno_messaging\Services\OpignoPrivateMessageService->getFirstThreadForUser() (line 38 of C:\xampp\htdocs\opigno-composer\web\modules\contrib\opigno_messaging\src\Services\OpignoPrivateMessageService.php).

    But, the 2nd error message occurs when I click the particular private message thread (a.k.a "Discussion"). The url is /private-messages/[an integer representing thread id]. For example: /private-messages/6.

    TypeError: Drupal\private_message\Form\PrivateMessageForm::__construct(): Argument #11 ($privateMessageBanManager) must be of type Drupal\private_message\Service\PrivateMessageBanManagerInterface, Drupal\Core\Form\FormBuilder given, called in C:\xampp\htdocs\opigno-composer\web\modules\contrib\opigno_messaging\src\Form\PrivateMessageForm.php on line 30 in Drupal\private_message\Form\PrivateMessageForm->__construct() (line 137 of C:\xampp\htdocs\opigno-composer\web\modules\contrib\private_message\src\Form\PrivateMessageForm.php).

    Can you look again and see if you can come up with another patch to fix the particular thread by visiting /private-messages/[an integer representing thread id] ? Thank you very much.

Production build 0.71.5 2024