Add EntityController as service

Created on 9 April 2024, 8 months ago
Updated 15 April 2024, 7 months ago

Problem/Motivation

I might have alternative routes where I want to show the JsonResponse and therefore wants to call EntityController:view().

Proposed resolution

Add the EntityController as service:

Drupal\transform_api\Controller\EntityController:
    class: Drupal\transform_api\Controller\EntityController
    arguments:
      - '@transform_api.transformer'
      - '@entity_type.manager'
      - '@config.factory'
Feature request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇩🇰Denmark nicklasmf

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

Comments & Activities

  • Issue created by @nicklasmf
  • 🇩🇰Denmark LupusGr3y

    Controllers aren't meant to be services, so all code that you want to be accessable otherwhere should be in services. Thankfully this is also already the case as the EntityController just uses the Transformer service. You could just do the same for your purposes.

  • Status changed to Closed: works as designed 7 months ago
Production build 0.71.5 2024