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

Sign up
Appearance settings

feat(laravel): Enable to skip autoconfiguration with new SkipAutoconfigure attribute #7467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ttskch wants to merge 1 commit into api-platform:main
base: main
Choose a base branch
Loading
from ttskch:feat/larabel-skip-autoconfigure

Conversation

@ttskch
Copy link
Contributor

@ttskch ttskch commented Oct 18, 2025

Q A
Branch? main
Tickets N/A
License MIT
Doc PR N/A

We discovered an issue where a circular dependency could occur when decorating a system processor such as WriteProcessor.

For example, create a decorator for WriteProcessor called AppWriteProcessor as follows:

$this->app->extend(WriteProcessor::class, function (WriteProcessor $inner) {
return new AppWriteProcessor($inner);
});
final class AppWriteProcessor implements ProcessorInterface
{
public function __construct(
private readonly WriteProcessor $decorated,
) {
}
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): mixed
{
return $this->decorated->process($data, $operation, $uriVariables, $context);
}
}

In this case, because AppWriteProcessor implements ProcessorInterface, it is tagged with ProcessorInterface and is therefore included as a dependency of CallableProcessor.

Furthermore, because CallableProcessor is included in the dependencies of WriteProcessor, a circular dependency occurs: CallableProcessor -> AppWriteProcessor -> WriteProcessor -> CallableProcessor.

The only two ways to prevent this is to change the constructor argument type of AppWriteProcessor to mixed instead of WriteProcessor, or to remove the tagging of AppWriteProcessor with ProcessorInterface.

This PR introduces a new SkipAutoconfigure attribute, which allows you to exclude some application code from autoconfigure.

I've created a minimal environment to reproduce this issue in the following GitHub repository, and the commit logs explain the process to resolve it.

https://github.com/ttskch/api-platform-laravel-system-provider-decoration-example/commits/main/

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /