Category: symfony5

Expected argument of type "string", "object" given at property path

I’m trying to change a password of a user. The user is selected in a dropdownlist. public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add(‘password’, PasswordType::class, array(‘label’ => ‘Password’)) ->add(‘reset’, SubmitType::class, array(‘label’ => ‘Reset’)) ->add(‘username’, EntityType::class, array(‘class’ => User::class, ‘query_builder’…

Symfony 5 add field to form after form submit

Lets assume I have the following form: public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add(‘paste’, TextareaType::class, [ ‘attr’ => array(‘rows’ => ’15’), ]) ->add(‘language’, ChoiceType::class, [‘choices’ => $this->languagesService->getSupportedLanguages()]) ->add(‘visibility’, ChoiceType::class, [‘choices’ => $this->visibilityService->getVisibilities()]) ->add(‘expiresAt’, ChoiceType::class, [‘choices’ => $this->expiryService->getExpiryTimes(), ‘mapped’…

Symfony remove "index.php" from twig generated path

I have just set up a new Symfony 5 application with a basic Twig template, routing using annotations. I have routes set up for ‘home’ and ‘terms and conditions’ pages: <?php namespace AppController; use SymfonyBundleFrameworkBundleControllerAbstractController; use SymfonyComponentRoutingAnnotationRoute; class GeneralController extends…

How to Translate Validation Constraint Messages

That is my first concern here. # config/validator/validation.yaml AppUsecaseGetEntityGetEntityRequest: properties: date: – Date: message: ‘get.date.msg’ How can I replace the placeholder “get.date.msg” with the right error msg? The official documentation does not help: https://symfony.com/doc/current/validation/translations.html Where exactly should the translation file…

How to implement multiple authentication in Symfony?

I am following following tutorial about Backend API AUthentication using JWT. https://rojas.io/building-a-jwt-authenticator-in-symfony-4/ I have two authentication in my API. LoginAuthenticator JwtAuthenticator. Below is my security.yaml file. security: encoders: AppEntityUser: algorithm: auto providers: app_user_provider: entity: class: AppEntityUser property: email firewalls: dev:…