Create a new CommentRepository for the code from Drupal\comment\CommentStorage

Created on 23 October 2023, 8 months ago

Problem/Motivation

The database driver for MongoDB needs to override the class Drupal\Core\Entity\Sql\SqlContentEntityStorage. MongoDB does document/JSON storage instead of relational database storage.
The Comment entity is overriding that class in Drupal\comment\CommentStorage. The problem for the database driver for MongoDB is that it then also needs to override the methods in Drupal\comment\CommentStorage. It also needs to duplicate the code inside Drupal\file\FileStorage too. Duplicating code is wrong.
Another problem is that the code in Drupal\comment\CommentStorage class is that it is NOT extending the functionality from the class Drupal\Core\Entity\Sql\SqlContentEntityStorage. The extra code can easily being moved to another class.

Proposed resolution

- Create a new Drupal\comment\CommentRepository class/service and move the code/methods from Drupal\comment\CommentStorage to the new class/service.
- Deprecate the methods and the class Drupal\comment\CommentStorage.

Remaining tasks

User interface changes

None

API changes

- New service comment_repository with the methods getMaxThread(), getMaxThreadPerThread(), getDisplayOrdinal(), getNewCommentPageNumber(), getChildCids(), loadThread() and getUnapprovedCount().
- The methods getMaxThread(), getMaxThreadPerThread(), getDisplayOrdinal(), getNewCommentPageNumber(), getChildCids(), loadThread() and getUnapprovedCount() in the class Drupal\comment\CommentStorage are deprecated.
- The class Drupal\comment\CommentStorage is deprecated.

Data model changes

None

Release notes snippet

None

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
CommentΒ  β†’

Last updated 2 days ago

Created by

πŸ‡³πŸ‡±Netherlands daffie

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

Comments & Activities

Production build 0.69.0 2024