Category: annotations

SearchAnnotation in class does not exist, or could not be auto-loaded

I’m trying to add a custom ‘OR’ SearchFilter for my ApiPlatform Services : I’m getting a weird error : The annotation “@AppFilterSearchAnnotation” in class AppEntityfoo does not exist, or could not be auto-loaded. My Code : AppFilterOrSearchFilter : <?php namespace…

How to automatically call a service in symfony 4

I have a service in my project services: exemple.annotation_reader: class: AppAnnotationModelAnnotationReader public: true arguments: [“@annotations.reader”] calls: – [getAnnotation] And I want call the methode “getAnnotation” without adding this line in my controller $this->get(‘exemple.annotation_reader’)->getAnnotation(); And there is my function getAnnotation public…

Symfony 5 @required annotation weird caching issue during setter injection?

I discovered this strange issue in Symfony 5 which I believe is connected to docker and Symfony itself. MY SETUP docker-compose.yml version: ‘3.7’ services: webapp: build: context: ./php/ dockerfile: Dockerfile container_name: webapp image: php:7.4.1-fpm-alpine volumes: – ../:/srv/app apache2: build: network:…

Symfony 5 : @IsGranted on method annotation doesn’t work on inherited role

I (obviously) searched for similar problems, but mine ain’t none of them. Here’s my case : I made a custom role : ROLE_SUPER_ADMIN My actual user is admin, his only role is ROLE_SUPER_ADMIN The role ROLE_SUPER_ADMIN inherits the ROLE_ADMIN (see…

Symfony Nelmio Framework Extra Bundle cache config by notation is being override on browser

When I set cache by notation on any controller of my symfony proyect: /** * @Cache(smaxage=”301″, maxage=”300″, public=true) */ public function fooAction(Request $request) { […] } max-age and public options are override when they reach the browser: Response headers Cache-Control:…

Can i use Symfony’s Route Annotation in Non-Symfony Project

I already tried things here https://symfony.com/doc/master/components/routing.html But i couldn’t make it. <?php use DoctrineCommonAnnotationsAnnotationReader; use SymfonyBundleFrameworkBundleRoutingAnnotatedRouteControllerLoader; use SymfonyComponentConfigFileLocator; use SymfonyComponentRoutingLoaderAnnotationDirectoryLoader; use ComposerAutoloadClassLoader; use DoctrineCommonAnnotationsAnnotationRegistry; /** @var ClassLoader $loader */ $loader = require __DIR__.’/vendor/autoload.php’; AnnotationRegistry::registerLoader([$loader, ‘loadClass’]); $loader = new AnnotationDirectoryLoader( new…