Call to an undefined method Drupal\feeds\Feeds\Target\Book::addMessage()

Created on 6 July 2024, 2 months ago
Updated 21 July 2024, about 2 months ago

Problem/Motivation

A spin-off issue from 🐛 Fix PHPStan errors Needs work . In the class Drupal\feeds\Feeds\Target\Book there is a call to an undefined method called addMessage(). A method with that name is defined in \Drupal\feeds\Plugin\Type\Target\FieldTargetBase, but Book doesn't extend that class, but \Drupal\feeds\Plugin\Type\Target\TargetBase instead.

As this proves that additional test coverage is needed, I decided to focus fixing this in a separate issue.

Steps to reproduce

The bug is only reproducable when extending the Book class and throw a \Drupal\feeds\Exception\TargetValidationException in there, because the exception isn't thrown in the class itself. (Well, technically it could also be reproduced when swapping the 'feeds.entity_finder' service and throw that exception in there, but that would make less sense in my opinion: the exception is expected to be only thrown in FeedsTarget plugins.)

Proposed resolution

Move the message related methods from \Drupal\feeds\Plugin\Type\Target\FieldTargetBase to \Drupal\feeds\Plugin\Type\Target\TargetBase.

Remaining tasks

  • Add a fix
  • Add test coverage
  • Commit

User interface changes

API changes

Data model changes

MR will come shortly.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇳🇱Netherlands MegaChriz

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024