---
title: "Breaking: Replace constructor DI with inject-methods in AbstractProfileFactory"
manual: "Academic Profiles"
version: "main"
source: "Changelog/2.1/Breaking-ReplaceConstructorDIWithInject-methodsInAbstractProfileFactory.rst"
rendered: "2026-10-02T20:47:49+00:00"
---

# Breaking: Replace constructor DI with inject-methods in `AbstractProfileFactory` {#breaking-1746705700}

## Description {#description}

Using constructor dependency injection in abstract classes defines the constructor
as API, which should be avoided by using the inject-method approach and allows to
implement classes using constructor DI without the requirement to deal and align
with parent (abstract) class constructor and passing it down.

`AbstractProfileFactory` used constructor DI and therefore violated the above
described design pattern.

Constructor DI arguments are now replaced with inject-methods in the abstract
`FGTCLBAcademicPersonsProfileAbstractProfileFactory`.

See [Autowiring other Methods (e.g. Setters and Public Typed Properties)](https://symfony.com/doc/current/service_container/autowiring.html#autowiring-other-methods-e-g-setters-and-public-typed-properties)

## Impact {#impact}

`AbstractProfileFactory` used constructor DI and therefore violated the above
described design pattern.

Constructor DI arguments are now replaced with inject-methods in the abstract
`FGTCLBAcademicPersonsProfileAbstractProfileFactory`.

## Affected Installations {#affected-installations}

Installations using the abstract and defining own constructor DI arguments.

## Migration {#migration}

Implementation using the abstract and defining own constructor DI arguments
needs to remove the removed parent arguments and avoid calling the parent
constructor.

Additionally, the `SymfonyContractsServiceAttributeRequired` attribute is
used for the inject methods to tell symfony DI that these inject methods needs
to be called and are mandatory - beside having a visually glue for developers.
