Questions tagged [symfony4]

Symfony is a PHP framework developed by SensioLabs. Symfony 4 was released in November 2017.

Symfony is a PHP web framework first released in July 2011 and was created by SensioLabs. Symfony 4 was released in November 2017. The latest LTS is 4.4.8 released in November 2019 and has support until 2022.

Differences from Symfony 3

  • Symfony Flex automates many of the tasks that previously had to be done manually - it’s based on Symfony Recipes, which are a set of automated instructions.
  • Version 4 also recommends a bundle-less setup, e.g. putting many of the source files directly in /src instead of something like /src/AppBundle.
  • Installing using the Symfony skeleton will create a relative small version of the app. Additional packages need to be added. A more fully-featured version (more similar to the »Symfony Standard Edition« in Symfony 3) is available with the Symfony Demo Application.
  • Minimum PHP 7.1.3

Documentation / Resources

  • Overview: Documentation for current version.
  • Flex: New way to manage Symfony apps.
  • Best Practices: Best practices for developing web apps, esp. the ones using the full-stack Symfony framework.
  • Symfony Recipes Server: Includes official and community recipes.
4007 questions
7
votes
2 answers

Symfony 4 multiple entities in single form

Been trying for hours and hours to get my multi entity form to work, but it really breaks my head and none of the examples I've found work. I checked the Collection form type documentation and form collections, as well as the Entity form type. I…
Miranda Breekweg
  • 207
  • 1
  • 2
  • 11
7
votes
1 answer

Webpack Encore Jquery Maximum call stack size

Im facing an issue after upgrading to Symfony 4.1 and switching to Encore. Uncaught RangeError: Maximum call stack size exceeded at _typeof (bundle.js?v=1.6565:3454) at _typeof (bundle.js?v=1.6565:3454) at _typeof (bundle.js?v=1.6565:3454) at…
7
votes
2 answers

Symfony 4 - controllers in two directories

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…
mariusz08
  • 83
  • 1
  • 4
7
votes
1 answer

Restrict Symfony 4 route to the "dev" environment

I'm using Symfony 4.1. I'm trying to create a route "/dev/import/{file}" which can only be accessed from within the 'dev' environment. This answer for Symfony 2 suggests adding the route to routing_dev.yml or adding condition:…
mcmurphy
  • 781
  • 16
  • 30
7
votes
2 answers

Symfony Codeception functional test: environment variable not found

I'm using Codeception v2.4.1 with PHPUnit 7.1.3 in a new Symfony 4 project. I created a functional test, and attempt to run it, and receive an error: ./vendor/bin/codecept run functional There was 1 error: --------- 1) CustomerControllerCest:…
Geoff Maddock
  • 1,700
  • 3
  • 26
  • 47
7
votes
2 answers

How do I load actual ENV var values into my bundle config?

I am trying to make a Symfony bundle. But I am unable to read the ENV vars I use in the config. (They are only loaded as placeholder) I created a config tree, with some values I'd like an application to use with ENV vars. The applications config…
milosa
  • 833
  • 1
  • 8
  • 18
7
votes
3 answers

Symfony 3.4 session time

In my Symfony 3.4 application, the user is automatically logged out after a certain period of time. I want to change this behaviour and make my application never log out automatically. It should log out the session only when the user clicks on the…
7
votes
5 answers

Symfony 4 SwiftMailer Gmail : Email not sent

I'm currently working on a Symfony 4 application and I need to send emails throught Swift Mailer. When I send an email, I receive the email spooled but I don't get it in my Gmail Mailbox. I allowed unsecure apps in my gmail configuration. This is my…
Salve Safari
  • 250
  • 1
  • 3
  • 10
7
votes
3 answers

Symfony 4 serialize entity without relations

I have to log the changes of each entity. I've Listener which listens for doctrine's events on preRemove, postUpdate and postDelete. My entity AccessModule has relations: App\Entity\AccessModule.php /** *…
nicram
  • 353
  • 3
  • 7
  • 24
7
votes
3 answers

Symfony4 Forms - EntityType with two choice_label

I'm pretty new to symfony and symfony forms. I have a form with an EntityType, that looks like this: ->add('customer', EntityType::class, [ 'label' => 'Kunde: ', 'class' => Customer::class, 'choice_label' => 'Name', 'query_builder'…
Dario
  • 618
  • 1
  • 11
  • 28
7
votes
1 answer

Symfony4: Doctrine2 works but no connection in PHPUnit test (kernel booted)

Strange issue in Symfony4: Doctrine works, I can validate the schema, create the database etc using php bin/console doctrine:schema:create. But my PHPUnit test does not have a connection. By running ./bin/phpunit I get SQLSTATE[HY000] [2002] No such…
mauserrifle
  • 604
  • 1
  • 7
  • 17
7
votes
6 answers

Symfony4: No route found for "GET /lucky/number"

I am starting to play with symfony4. I've just created new application and create new LuckyController. It works with routes.yaml configured in this manner: lucky: path: /lucky/number controller: App\Controller\LuckyController::number With…
sensorario
  • 20,262
  • 30
  • 97
  • 159
7
votes
4 answers

More than one application per project repository with Symfony 4

I have three old applications (running on Symfony 2) where each one has been developed in separated git repositories and configured in their respective vhosts: company.com Company website. admin.company.com Website administration. api.company.com…
user8020553
6
votes
2 answers

Use Action class instead of Controller in Symfony

I am adherent of Action Class approach using instead of Controller. The explanation is very simple: very often Controller includes many actions, when following the Dependency Injection principle we must pass all required dependencies to a…
Serhii Popov
  • 3,326
  • 2
  • 25
  • 36
6
votes
2 answers

EasyAdmin 3 : Nested forms

I'm trying to embed forms into forms. In my case : I want to embed Period and Price form into Offer form into Poi form. The architecture : Poi form Offer form Price form Period form Relations: Poi entity has relation OneToMany with Offer…
LazyLez
  • 61
  • 1
  • 2