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
1
vote
1 answer

Custom base entity in Symfony 4

I am using Symfony 4 and with Doctrine where I have entities which have the same common attributes such as createdWhen, editedWhen, ... What i would like to do is this: Defining a kind of base entity that holds these common attributes and implements…
1
vote
1 answer

Symfony4 Element legend not allowed as child of element div in this context

Symfony is generating a W3C error and I don't know how to resolve it : Element legend not allowed as child of element div in this context here is the HTML line :
Tom Paler
  • 67
  • 1
  • 11
1
vote
1 answer

"make:entity --regenerate" creates an incorrect (?) function

I'm currently following a Symfony tutorial, and I've gotten to the part of Doctrine bidirectional relations (sorry if the terms I'm using are wrong, I'm not an native English speaker). My model is based on an Advert (One-To-Many) that displays an…
1
vote
2 answers

How to insert dummy data via fixtures to foreign column symfony

I have two enity user and post. I am trying to dump dummy data to post table using fixtures. Now, problem is that I could not insert data to author column which holds ManyToOne relation with User entity. I tried to insert dummy data by passing id…
Aayush Dahal
  • 856
  • 1
  • 17
  • 51
1
vote
1 answer

How to display error on my input file on Symfony 4?

I work on my first symfony project and I need to create nice errors for a form with an uploading input. Actually, I change with success my parameters to a limit post of 20Mo and a limit size for an uploaded file of 20Mo. In my entity, I have an…
Noxray
  • 50
  • 5
1
vote
1 answer

Login Symfony 4.2 Method checkCredentials return false

When I try to log into the system I get information that I enter incorrect data. The method returns false with the message: Authentication failed because App\Security\LoginFormAuthenticator::checkCredentials() did not return true. Logging I do…
1
vote
1 answer

Allowing Symfony 4 and Doctrine for duplicate ManyToMany relations

I want to create ManyToMany relation with duplicate options. One USER can have many CARS and many CARS can belong to various USERs. At the same time, one USER can own many cars of the same type. How do I solve this in Symfony 4 and Doctrine?
1
vote
1 answer

Symfony 4 how to delete entity from OneToMany relationship

I'm having a bit of a problem deleting an entity assigned to another with a OneToMany relationship. I have an entity called Business and it has a property "units" which is a collection of Unit entities on a OneToMany relationship (business can have…
Glen Elkins
  • 867
  • 9
  • 30
1
vote
1 answer

Symfony4 is there any way to get my Domain Name?

I know i can get a lot of informations about the HTTP request by doing $request->getSomething, but I didn't find anything anywhere to get my domain name. I need it for mailing, when i click on links in mails
user11056335
1
vote
1 answer

Load data fixtures in setUpBeforeClass with LiipFunctionalTestBundle

As the title says, I'd like to know how to load the data fixtures in the method setUpBeforeClass. The test class extends Liip\FunctionalTestBundle\Test\WebTestCase. At the moment I have this: public function setUp() { $this->client =…
cezar
  • 11,616
  • 6
  • 48
  • 84
1
vote
2 answers

Symfony 4 - Custom GuardAuthenticator doesn't set remember me cookie

I'm building a custom GuardAuthenticator to login with a token on a specific route. According to the documentation if supportsRememberMe() returns true and remember_me is activated in the firewall, the remember me cookie should be set, but it's not…
Rmy5
  • 527
  • 8
  • 21
1
vote
1 answer

How to unit test entity assert in Symfony form?

With Symfony 4.2, I have entity with assert : ... /** * @var string * * @Assert\NotBlank() * @Assert\Email() */ private $email; ... I have a form for this entity : $builder ... ->add('email', null, [ 'label' => 'label.email', …
Gaylord.P
  • 1,539
  • 2
  • 24
  • 54
1
vote
2 answers

Symfony4, how to properly handle missing form field ? (without exception in $this->propertyAccessor->setValue)

I have a Task entity, with two mandatory, non-nullable, fields: title dueDatetime and Form to create task. The form is called by external scripts through POST with application/x-www-form-urlencoded (so no json or anything fancy), so I use…
allan.simon
  • 3,886
  • 6
  • 35
  • 60
1
vote
2 answers

Symfony bundle configuration array node default value merge

I have a problem with Symfony4 bundle configuration. I have a configuration class with: $rootNode ->children() ->arrayNode('mapping') ->useAttributeAsKey('code') ->prototype('scalar')->end() …
Lucas
  • 47
  • 2
  • 10
1
vote
1 answer

Symfony Form Transformer on CheckboxType: String to Bool

I have a symfony4 form that has a CheckboxType and submitted with string values ('0' or '1'). Now, I want to convert them to booleans. When getting the data (view transform), a boolean value should be returned. I have followed this…
vtni
  • 950
  • 3
  • 14
  • 43
1 2 3
99
100