symfony4

How to remove index.php from Symfony4 router?

为君一笑 提交于 2020-08-19 04:30:18
问题 I have been following Symfony 4 documentation as to how to configure a web server. https://symfony.com/doc/current/setup/web_server_configuration.html My .conf file in my apache 2.4 configuration is exactly as described in their documentation. I’m copying part of it here : <Directory /var/www/project/public> AllowOverride None Require all granted Allow from All <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L

Update an entity in Symfony 4?

大城市里の小女人 提交于 2020-07-22 12:26:38
问题 My question is simple, but I can't find a fine answer to it, I had an entity created by a command line : php bin/console make:entity this entity is User that has few attribute ( name - email - password ) After inserting the fields, I migrated, so my table has been created in the database using those commandlines : php bin/console make:migration php bin/console doctrine:migration:migrate But now I want to just change the name to a username but I don't know how to do it. I did not find anything

Update an entity in Symfony 4?

自闭症网瘾萝莉.ら 提交于 2020-07-22 12:24:28
问题 My question is simple, but I can't find a fine answer to it, I had an entity created by a command line : php bin/console make:entity this entity is User that has few attribute ( name - email - password ) After inserting the fields, I migrated, so my table has been created in the database using those commandlines : php bin/console make:migration php bin/console doctrine:migration:migrate But now I want to just change the name to a username but I don't know how to do it. I did not find anything

Symfony 4 TextType required = false getting Expected argument of type “string”, “NULL” given

99封情书 提交于 2020-07-22 06:52:53
问题 I have a TextType field which is set as below Type: ->add('zipCode',TextType::class, array( 'attr' => array('maxlength' => 10), 'required' => false, 'empty_data' => null ) ) When the data loads from the database the field is null. I just attempt to submit the form and I get Expected argument of type "string", "NULL" given. at vendor/symfony/property-access/PropertyAccessor.php:174 at Symfony\Component\PropertyAccess\PropertyAccessor::throwInvalidArgumentException('Argument 1 passed to App

Symfony 4 - controllers in two directories

时光总嘲笑我的痴心妄想 提交于 2020-07-09 08:51:11
问题 In my application, I use Symfony 4. I want Symfony to search for controllers in two directories: A and B. I found something like this: controllers: resource: '../src/DirectoryA/Controller/' type: annotation , but it only works for one directory. How can I have Symfony to search for controllers in two directories? Regards 回答1: In your config/services.yaml App\DirectoryA\Controller\: # assuming you have namespace like that resource: '../src/DirectoryA/Controller' tags: ['controller.service

Symfony 4.1 twig extension

不想你离开。 提交于 2020-06-26 12:25:23
问题 In Symfony 4.1 I created an twig extension and I tried to use it as an service twig.extension.active.algos: class: App\Twig\AppExtension public: true tags: - { name: twig.extension, priority: 1024 } Unfortunately I receive 'Unable to register extension "App\Twig\AppExtension" as it is already registered' After many searches I saw that there was a bag in the version of symfony 3.4 but they say the error would have solved. So it's my mistake or just another mistake from symfony team. My