0

My Symfony project's folders structure looks like this:

  • src

    • API

      • V1

        • Systems

          • System1

            • Platform.php
          • System2

            • Platform.php
          • System3

            • Platform.php
          • SystemN

          • ..............

I want to create my services via Multiple Service Definitions Using the Same Namespace.
My services.yaml:

services:
...........
    platform_names:
        namespace: App\API\V1\Systems\
        public: true
        resource: '../src/API/V1/Systems/*/Platform.php'
        tags: [ platform_name ]
        factory: '@App\API\V1\Systems\SystemsPlatformFactory'
        arguments:
            $platform_name: platform_name

And I get my service somewhere in my code:

$this->getContainer()->get('App\API\V1\Systems\System1\Platform');

Are there any ways to pass the requested service id (System1) into the factory SystemsPlatformFactory?
I tried

        arguments:
            $platform_name: platform_name

but that doesn't work.

0 Answers0