Skip to content
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

Enable OPCache Preloading on SF 4.4 #3852

Closed
pesseyjulien opened this issue Nov 27, 2020 · 5 comments
Closed

Enable OPCache Preloading on SF 4.4 #3852

pesseyjulien opened this issue Nov 27, 2020 · 5 comments

Comments

@pesseyjulien
Copy link

Hi,

Trying to enable opcache preloading : https://symfony.com/blog/new-in-symfony-4-4-preloading-symfony-applications-in-php-7-4

I have setup the option on my php config but I'm getting the following error :

Argument 1 passed to ApiPlatform\Core\Metadata\Property\Factory\CachedPropertyNameCollectionFactory::create() must be of the type string, null given, called in /app/vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php on line 330

Code where it's triggered :


        $groups = ['read_user', 'me_user'];
        if($user->hasProfile('worker')) $groups[] = 'worker';
        $serializedEntity = $this->container->get('serializer')->serialize($user, 'json', ['groups' => $groups]);
        return new Response($serializedEntity, 200, ['Content-Type' => 'application/json']);

Any idea what i'm doing wrong ?

Thanks in advance,
Julien

@soyuka
Copy link
Member

soyuka commented Nov 27, 2020

Maybe that it needs the same fix as in #3827 ?

@crls-brtlm
Copy link

I've also found this problem... Same error.
Did you have any advance with it?

@pesseyjulien
Copy link
Author

nop :/

@crls-brtlm
Copy link

Maybe, this is an issue that can be solved with the tags container.preload and container.no_preload for the affected classes which can define which classes should be preloaded by PHP as stated here https://symfony.com/doc/current/performance.html.

Unfortunately, I'm using SF 4.4 and these tags were introduced on SF 5.1

@pesseyjulien
Copy link
Author

Upgraded to SF 5.2 and no error anymore !

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

No branches or pull requests

3 participants