Skip to content

Conversation

@esserj
Copy link
Contributor

@esserj esserj commented Oct 31, 2025

Q A
Branch? main
Tickets n/a
License MIT
Doc PR api-platform/docs#2224

You can now configure the base namespace prefix for all makers but also add a command line option in case you want to customize the namespace even further

This allows developers to organize all api code into a single namespace/directory

Example

api_platform:
    maker:
        namespace_prefix: Api

will cause all generated classes to be created in src/Api

Cli Example

bin/console make:state-provider --namespace-prefix Api\\StateProvider

will cause the generated provider to be created in src/Api/StateProvider
the same applies to the processor and filter maker

$services = $container->services();

$services->set('api_platform.maker.command.state_processor', 'ApiPlatform\Symfony\Maker\MakeStateProcessor')
->args([service('api_platform.metadata.resource.name_collection_factory')])
Copy link
Contributor Author

@esserj esserj Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service('api_platform.metadata.resource.name_collection_factory') was introduced in the original PR
But there was no dependency on this class then, or is now, so I'm assuming this was a leftover from an earlier approach

@esserj esserj force-pushed the configurable-maker-paths branch 3 times, most recently from c0c31ee to 2db31bb Compare October 31, 2025 08:02
@esserj esserj changed the title Feat: allow symfony makers namespace configuration feat(maker): allow symfony makers namespace configuration Oct 31, 2025
@esserj esserj force-pushed the configurable-maker-paths branch 2 times, most recently from 4306e7b to 8eec7c8 Compare October 31, 2025 08:32
@soyuka
Copy link
Member

soyuka commented Oct 31, 2025

Nice thanks, could you run cs and fix your commit ? thanks!

@esserj esserj force-pushed the configurable-maker-paths branch from 8eec7c8 to a4530c0 Compare October 31, 2025 09:04
@esserj
Copy link
Contributor Author

esserj commented Oct 31, 2025

Done

@esserj esserj force-pushed the configurable-maker-paths branch from a4530c0 to 0f75ef8 Compare October 31, 2025 09:46
@esserj esserj changed the title feat(maker): allow symfony makers namespace configuration feat(symfony): allow symfony makers namespace configuration Oct 31, 2025
@esserj esserj force-pushed the configurable-maker-paths branch from 0f75ef8 to 419e021 Compare October 31, 2025 12:06
@esserj
Copy link
Contributor Author

esserj commented Oct 31, 2025

These other CI failures seem to be unrelated (at least one has an outsanding PR with a fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants