Created on 10 October 2024, about 1 month ago

Problem/Motivation

Thank you very much for this great module! I agree that this concept would make A LOT of sense in core.

Again and again I'm running into situations, where I'd like to extend Entity objects with further functionality, which simply belongs there in OOP.

Do you know about any core proposals? Or would you create one based on your module with your knowledge?

If you find any, could you list them on the module page?
Perhaps it might be things like "Decorator" or so?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

1.0

Component

Documentation

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

  • Issue created by @Anybody
  • 🇵🇱Poland sebaz

    What is new in this concept when you can use dependency injection or just override User entity clas by your own class set in hook_entity_type_alter()

    /**
     * Implements hook_entity_type_alter().
     */
    function my_module_entity_type_alter(array &$entity_types) {
      if (isset($entity_types['user'])) {
        $entity_types['user']->setClass(\Drupal\my_module\Entity\CustomUser::class);
      }
    }
    

    ?

Production build 0.71.5 2024