symfony4

Symfony 4 in subdirectory

别来无恙 提交于 2020-01-15 10:23:02
问题 I'm a French developer and I did install Symfony 4 on a subdirectory of my wamp localhost. My project is named "cardMaker". I've a .htaccess file to redirect towards the public directory (index.php) : <IfModule mod_rewrite.c> RewriteEngine On RewriteRule "^$" public/ [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . srcAngular/index.html [L] </IfModule> That works. But, when I open http://localhost/cardMaker/ , I have this issue How can I set the base

Symfony 4 in subdirectory

僤鯓⒐⒋嵵緔 提交于 2020-01-15 10:22:02
问题 I'm a French developer and I did install Symfony 4 on a subdirectory of my wamp localhost. My project is named "cardMaker". I've a .htaccess file to redirect towards the public directory (index.php) : <IfModule mod_rewrite.c> RewriteEngine On RewriteRule "^$" public/ [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . srcAngular/index.html [L] </IfModule> That works. But, when I open http://localhost/cardMaker/ , I have this issue How can I set the base

Saving related objects in API Platform

本小妞迷上赌 提交于 2020-01-15 09:36:48
问题 I am new to API Platform and Symfony 4 , I have a situation where we have 3 entity related to each other: User , Jobseeker , JobseekerLocation so when we need add register new Jobseeker can we make entry in related table automatically? Some kind of triggering. Or we should make 3 API call to reach and save the data? 回答1: Use the @Groups() https://api-platform.com/docs/core/serialization/ /** * @ApiResource() */ class User { /** * @Groups({"registration"}) * @ORM\ManyToOne/OneToOne(...) */

Saving related objects in API Platform

别来无恙 提交于 2020-01-15 09:36:05
问题 I am new to API Platform and Symfony 4 , I have a situation where we have 3 entity related to each other: User , Jobseeker , JobseekerLocation so when we need add register new Jobseeker can we make entry in related table automatically? Some kind of triggering. Or we should make 3 API call to reach and save the data? 回答1: Use the @Groups() https://api-platform.com/docs/core/serialization/ /** * @ApiResource() */ class User { /** * @Groups({"registration"}) * @ORM\ManyToOne/OneToOne(...) */

Symfony 4 change password by username - email can not be null

爷,独闯天下 提交于 2020-01-14 10:33:50
问题 Introduction I have been trying to figure out how to create a reset password form that's governed by username value. The Error Path Message Invalid value Violation data.email This value should not be blank. null ConstraintViolation {#945 ▼ -message: "This value should not be blank." -messageTemplate: "This value should not be blank." -parameters: [▶] -plural: null -root: Form {#620 ▶} -propertyPath: "data.email" -invalidValue: null -constraint: NotBlank {#477 …} -code: "c1051bb4-d103-4f74

Load different .env file with a Symfony 4 command

耗尽温柔 提交于 2020-01-14 03:03:59
问题 .env file is parsed when running a Symfony 4 command (if dotenv is available). This is working fine when developping, but also, I want to test my code (so another environment), hence I need to load another .env file. I love what Docker did to run a container: docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash So I am looking to achieve same thing with Symfony: php bin/console --env-file ./.env.test right now, I am doing this: export $(grep -v '^#' .env.test | xargs) &&

Load different .env file with a Symfony 4 command

孤街醉人 提交于 2020-01-14 03:03:23
问题 .env file is parsed when running a Symfony 4 command (if dotenv is available). This is working fine when developping, but also, I want to test my code (so another environment), hence I need to load another .env file. I love what Docker did to run a container: docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash So I am looking to achieve same thing with Symfony: php bin/console --env-file ./.env.test right now, I am doing this: export $(grep -v '^#' .env.test | xargs) &&

My profiler toolbar isn't showing up in symfony 4.3.1

做~自己de王妃 提交于 2020-01-12 14:59:31
问题 In my .env file, I have specified my app environment to be dev and debug to be true like so: APP_ENV=dev APP_DEBUG=true In my config/packages/dev/web_profiler.yaml file I have the following: web_profiler: toolbar: true intercept_redirects: false framework: profiler: { only_exceptions: false } The routing within config/routes/dev/web_profiler.yaml seems to be fine: web_profiler_wdt: resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' prefix: /_wdt web_profiler_profiler: resource: '

Symfony4 Route not found with path param if contains a dot

亡梦爱人 提交于 2020-01-06 07:24:14
问题 If I navigate to this route with this slug (/client/example.com) /** * @Route("/client/{url}") */ I get this error The requested resource "/client/example.com" was not found on this server. I'm using php built-in server php -S 127.0.0.1:8000 public/index.php With this aproach it works but assets doesn't load properly php -S localhost:8000 public/index.php Edit: without dot it works. php bin/console router:match /client/example.com [OK] Route "client_show" matches php bin/console router:match

PhpStorm Symfony 4 ContactType class not recognized

主宰稳场 提交于 2020-01-06 06:43:40
问题 I have a very annoying problem today. I'm on Macbook Pro, PhpStorm 2017.3.6. I tried to create a simple Symfony 4 contact form but something goes wrong with PhpStorm, the class "Contact Type" isn't recognized at all. I already tried to: Clear and invalidate PhpStorm cache Clear Symfony cache Reboot the Macbook Updated PhpStorm to 2017.3.6 I also tried to create the formType with another names, like TotoType for example and it's working, so its only with ContactType that's not working. I use