Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DI] Cannot instantiate abstract class #22345

Copy link
Copy link
Closed
@pierredup

Description

@pierredup
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.0-dev

When defining a service without the class config, and that has an abstract parent, I'm getting the error Cannot instantiate abstract class ...

Class definitions:

abstract class AbstractTestService {}

class TestService extends AbstractTestService { }

This is the service definition:

AppBundle\AbstractTestService:
    abstract: true

AppBundle\TestService:
    parent: AppBundle\AbstractTestService

Whenever I try to use the AppBundle\TestService service, I'm getting the above mentioned error.

This config however works, when I add the class option to the TestService definition

AppBundle\AbstractTestService:
    abstract: true

AppBundle\TestService:
    class: AppBundle\TestService
    parent: AppBundle\AbstractTestService

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.