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

Synthetic service cannot be define if binds are present #32874

Copy link
Copy link
Closed
@noemi-salaun

Description

@noemi-salaun
Issue body actions

Symfony version(s) affected: tested with 3.4 and 4.3

Description

If I define a synthetic service in my service.yaml config file where binds are already defined, I get the error

Invalid service "my_synthetic_service": class "" does not exist.

How to reproduce

  1. Create a new app:
symfony new my-app
  1. Add the service definition and the bind in config/services.yaml
services:
    _defaults:
        # ...
        bind:
            $someBind: someValue

    # ...

    my_synthetic_service:
        synthetic: true
        public: true
  1. Run any console command
./bin/console debug:container my_synthetic_service
  1. Get the full error

Unused binding "$someBind" in service "my_synthetic_service".
Could be related to:

  • Invalid service "my_synthetic_service": class "" does not exist.

This error is a little more understandable than the first one, but I have to try finding the minimal failing exemple to get this error

  1. Add some service that use the bind
<?php
namespace App\Service;
class SomeService
{
    public function __construct(string $someBind) {  }
}
  1. Re-run the console command
  2. Get the minimal error

Invalid service "my_synthetic_service": class "" does not exist.

This error is way worse to debug the real problem

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.