-
-
Notifications
You must be signed in to change notification settings - Fork 937
fix(symfony): implement checkContainerIsBooted for bc-layer #7002
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
Conversation
1cf0ba8 to
02a82c3
Compare
|
|
||
| return $iriConverter->getIriFromResource($resource); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- suggestion: Rename the method and the
$kernelOptions['checkContainerIsBooted']toalwaysBootKernelfor better clarity - suggestion: Set
falseas default value, so there is no need to set it inApiTestCaseTest::checkContainerIsBooted - suggestion: Encourage people using Alice to set this value to true by adding a comment on the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using false will certainly break current usages I'll move to false in API Platform 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on how we name the method. When using checkContainerIsBooted --> default value is false, if we name it alwaysBootKernel --> default value should be true.
BTW, I proposed #7007 for this bug fix if you want to adapt yours accordingly.
| if (null === ($checkContainerIsBooted = $kernelOptions['checkContainerIsBooted'] ?? static::checkContainerIsBooted())) { | ||
| trigger_deprecation('api-platform', '5.0', \sprintf('In API Platform 5.0 we will not boot the kernel if it is booted already. Define the kernelOptions "checkContainerIsBooted" or implement "%s::checkContainerIsBooted" to return false if you want to keep the old behavior.', static::class)); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- question: IMHO, there is no need to check
!static::$bootedif we want to keep exactly the same behaviour as before. - question: Maybe the condition can be simplified to
if ($checkContainerIsBooted)because it's a boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- suggestion:
overrideinstead ofimplements
| { | ||
| if (!static::$booted) { | ||
| if (null === ($checkContainerIsBooted = $kernelOptions['checkContainerIsBooted'] ?? static::checkContainerIsBooted())) { | ||
| trigger_deprecation('api-platform', '5.0', \sprintf('In API Platform 5.0 we will not boot the kernel if it is booted already. Define the kernelOptions "checkContainerIsBooted" or implement "%s::checkContainerIsBooted" to return false if you want to keep the old behavior.', static::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Use api-platform/core instead of api-platform in package parameter ?
fixes #6991