Category: symfony5

Why is my Symfony 5 local server showing the HTTP request as text instead of a rendered page?

I just wanted to try out Symfony 5 for my own education, so I followed the instructions here. symfony check:requirements shows that I have the requirements needed to run the application (I’m running Windows 10 with php 7.3.4 running via…

How to avoid handling messages from "child" classes in Symfony Messenger?

I guess I’m missing something in the documentation, but the question is pretty simple. Let’s say I have a message of class MessageOne and MessageTwo which extends MessageOne. I also have MessageOneHandler which should handle MessageOne: __invoke(MessageOne $messageOne) And MessageTwoHandler…

Symfony validation messages always in default locale

So I’ve configured a site to have several locales depending on the locale in the URL, for example: http://127.0.0.1:8000/signup/es/ http://127.0.0.1:8000/signup/en/ I have a LocaleSubscriber, like this: public function onKernelRequest(RequestEvent $event) { $request = $event->getRequest(); /* If first request */ if…

OneToMany relation when using custom identifier in GraphQL returns null/wrong data

I am using api-platform with Symfony 5 to build GraphQl API. When using custom identifier that is not a primary key, OneToMany result set returns null or wrong data. This issue is caused because when fetching data from OneToMany table,…

How can I automatically register ‘controllers as services’ in other directories in Symfony 5

Background I want to use functional cohesion to organise my controllers. This means that I will not have a Controllers/ directory, which makes it easy for the framework, but I will organise my code by use-case. An arbitrary example: src/FetchLatestNews/Controller.php…

Symfony: send failed messages via email

I have a simple messanger config: framework: messenger: failure_transport: failed transports: async: dsn: ‘%env(MESSENGER_TRANSPORT_DSN)%’ retry_strategy: max_retries: 2 delay: 10000 failed: ‘doctrine://default?queue_name=failed’ routing: someInterface: async I would like to know about every message routed to failed transport f.e. system should send…

Unable to guess the MIME type as no guessers are available (have you enable the php_fileinfo extension?) | in Symfony 5.08

I got some error when i tried to upload image on easyadmin with vich_uploader. Unable to guess the MIME type as no guessers are available (have you enable the php_fileinfo extension?) I have enabled php_fileinfo extension but that didn’t solve…