Skip to content

Conversation

@soyuka
Copy link
Member

@soyuka soyuka commented Mar 7, 2025

fixes #6991

@soyuka soyuka force-pushed the fix/6991 branch 6 times, most recently from 1cf0ba8 to 02a82c3 Compare March 8, 2025 12:28

return $iriConverter->getIriFromResource($resource);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. suggestion: Rename the method and the $kernelOptions['checkContainerIsBooted'] to alwaysBootKernel for better clarity
  2. suggestion: Set false as default value, so there is no need to set it in ApiTestCaseTest::checkContainerIsBooted
  3. suggestion: Encourage people using Alice to set this value to true by adding a comment on the method

Copy link
Member Author

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

Copy link
Contributor

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));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. question: IMHO, there is no need to check !static::$booted if we want to keep exactly the same behaviour as before.
  2. question: Maybe the condition can be simplified to if ($checkContainerIsBooted) because it's a boolean

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. suggestion: override instead of implements

{
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));
Copy link
Contributor

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 ?

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