AutowireTrait and autowire for services behave differently for nullable types

Created on 29 July 2024, 9 months ago

Problem/Motivation

Hello, When using AutowireTrait and autowire option for services, you will get different behavior if the service does not exist:

  1. For services, you will be left with null
  2. When using AutowireTrait, you will get an exception about the service not existing.

I think this is a problem because their behavior should be as similar as possible.

Steps to reproduce

  1. Create a controller that accepts a service from another module as optional, and leave the other module disabled.
  2. Try to instantiate the controller

Proposed resolution

Check if the parameter is nullable, if so then skip throwing an exception if the service does not exist and set the argument to null.

Remaining tasks

  1. Fix.
  2. Test coverage.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 4 hours ago

Created by

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