Skip to content

[DI] master: Can't use 'factory' in '_instanceof' in service Yaml #22489

Closed
@mattjanssen

Description

@mattjanssen
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.x-dev

A few weeks ago on master I was able to use factory in my _instanceof Yaml service declarations. This was useful because all instances of DoctrineRepository need the same factory call. Without it, all DoctrineRepositories have to duplicate the same factory line. The purpose of _instanceof to reduce duplication would be better served if we could use factory.

@nicolas-grekas I edited DependencyInjection/Loader/YamlFileLoader and added 'factory' => 'factory' to the $instanceofKeywords array and it seemed to work. Any drawbacks? Better solutions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions