Skip to content

[DI] Enable factory attribute in service defaults #22189

Closed
@curry684

Description

@curry684
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version master

Following up on #22143, the lack of proper error is solved now in #22185, but the use case for factory still seems valid:

services:
    _defaults:
        factory:        [ "@doctrine", getRepository ]

    AppBundle\RoleRepository:
        arguments:      [ "AppBundle:Role" ]
    AppBundle\UserRepository:
        arguments:      [ "AppBundle:User" ]

It was decided in #21071 (comment) to consider the factory attribute a detector flag for real services, but this has become obsolete, and the use case for default factory settings is there.

Therefore I propose to reallow factory in _defaults sections.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions