Questions tagged [symfony]

Symfony refers to both a PHP framework for building web applications as well as a set of components on which the framework is built. This tag refers to the currently supported major versions 3.x, 4.x, 5.x and 6.x. Alternatively, you can specify an exact version using the respective tag. This tag should not be used for questions about Symfony 1.x. Please use the Symfony1 tag instead.

Symfony is a framework for web and CLI-applications built on top of a catalogue of Symfony components. It is free software released under the MIT license. The project's homepage is symfony.com.

Symfony aims to speed up the creation and maintenance of web applications and replace repetitive coding tasks by providing a rich set of components and integrations for other libraries through bundles. It has a low-performance overhead used with a bytecode cache and is aimed at building robust applications in an enterprise context, and aims to give developers complete control over the configuration: from the directory structure to the foreign libraries. Almost everything can be customized. To match enterprise development guidelines, Symfony is bundled with additional tools to help developers test, debug and document projects. Most of the components making up the framework can be used outside of the framework in other projects and libraries.

Components

Besides being a full-stack framework, Symfony is also a set of decoupled and Components.

Some of the Components have their own tag:

Information

This tag should be used for generic Symfony questions. You can also use other tags when the question is related to a specific version: , , , , , , , , , , , , , , , , , , , and .

If your question is about Symfony 1.x, please use instead.

The latest stable version can be found on the releases page.

Symfony also maintains Long Term Support (LTS) releases, which are held for several years (while “normal” releases are only maintained for about eight to ten months). The Symfony team is committed to providing a direct upgrade path between Long Term Support releases.

Related projects

Symfony is used as a basis for many other projects, such as , or

Useful links

Note: Before using any documentation, verify that the version of the documentation matches the Symfony version of your installation.

Upgrade between each version:

Interesting questions:


Symfony is released under the MIT license. The full license text is available on the website.

73565 questions
13
votes
2 answers

symfony2 form disable

I am using the same form to "preview" an object as I am to "edit/update" the same object. In my showAction() for the controller I have the following code: $form = $this->createForm(new SalesEntityType($entity), $entity, array('read_only' => true)…
Cosmtar
  • 516
  • 5
  • 14
13
votes
1 answer

Doctrine does not update a simple array type field

Short Story (Edit) It is possible to store an array instead of a mapped association. In Symfony2, this is fairly easy using the collection Field Type. For example, using this technique, you could store an array of text fields that populate an array…
Mick
  • 30,759
  • 16
  • 111
  • 130
13
votes
1 answer

Allow array (with default value) or null in Symfony 2.1 semantic configuration

I need to define an array node with a given default value in a bundle's semantic configuration. This currently looks like: $node->arrayNode('foo') ->prototype('scalar')->end() ->defaultValue(array('1', '2', '3')) ->end(); I…
Thomas Luzat
  • 710
  • 7
  • 21
13
votes
2 answers

Extending entities in Symfony2 with Doctrine2

I'm having trouble finding a way to appropriately extend an Entity across bundles in Symfony2 using Doctrine2 as the ORM. Currently there are three methods that I've found to extending entities in Symfony2 using Doctrine2 as the ORM. Mapped…
Jgarib
  • 166
  • 1
  • 1
  • 6
13
votes
3 answers

Symfony2, twig and JavaScript

What do I need to do to get twig to process a JavaScript file? I have an html.twig that uses a JavaScript twig. Something like this: {% extends 'BaseBundle::layout.html.twig' %} {% block javascripts %} {{ parent() }} {% javascripts …
Doo Dah
  • 3,979
  • 13
  • 55
  • 74
13
votes
1 answer

Steps to move Symfony 2 project to hosting?

I have read a lot of articles and questions about deploying of Symfony 2 project on a production server, but still, this is not clear. Deploy of Symfony project looks like a hell - nobody knows how to do this correctly. I suppose the best topic I…
sphinks
  • 3,048
  • 8
  • 39
  • 55
13
votes
4 answers

Lookup route in symfony 2

I've defined a route in my app routing file: RouteName: pattern: /some/route defaults: { _controller: MyAppBundle:Controller:action } In a controller I can use: $this->get('router')->generate('RouteName'); How would I simply access that…
user623520
13
votes
5 answers

How do I check for user role in symfony2 for urls not falling under patterns defined security.yml?

I have a admin panel and I have defined a role for it ROLE_ADMIN. In my security.yml file I am using a pattern ^/admin/* so every thing under /admin requires ROLE_ADMIN. Now in frontend of my app I need to check user role and if role is ROLE_ADMIN…
aditya
  • 996
  • 2
  • 12
  • 25
13
votes
7 answers

PHP Fatal error: Class 'Application\Sonata\MediaBundle\ApplicationSonataMediaBundle' not found in /var/www/znata.com/app/AppKernel.php on line 47

i followed this doc to install SonataMediaBundle but i got this error: PHP Fatal error: Class 'Application\Sonata\MediaBundle\ApplicationSonataMediaBundle' not found in /var/www/znata.com/app/AppKernel.php on line 47 After using the sonata command…
skonsoft
  • 1,786
  • 5
  • 22
  • 43
13
votes
2 answers

How to properly change what composer or Symfony2 does after running 'composer update/install'?

There are some scripts that are executed after I run composer. The problem is that they do things that I don't want, like php assets:install (without --symlink). So I need to either be able to remove that, or add my own script to do php…
ChocoDeveloper
  • 14,160
  • 26
  • 79
  • 117
13
votes
5 answers

Can i use query in form builder to get filtered collection in symfony form

IN the AcmePizza BUndle this is working fine ->add('pizza', 'entity', array( 'class' => 'Acme\PizzaBundle\Entity\Pizza', 'query_builder' => function ($repository) { return…
Mirage
  • 30,868
  • 62
  • 166
  • 261
13
votes
6 answers

Static assets not refreshing with symfony2 clear cache command

I'm using Assetic with the compass filter to pass and compile .scss files. This part of the setup seems to work fine. However, my understanding was that in the app_dev environment, Symfony 2 would recompile all assets (including css) for each page…
musoNic80
  • 3,678
  • 9
  • 40
  • 48
13
votes
3 answers

Non blank file input field in Symfony2 form

In my Doctrine entity, which is data_class for my form I have a file property defined like this: /** * Image. * * @Assert\NotBlank * @Assert\File * @Assert\Image(minWidth="138", minHeight="96") */ protected…
umpirsky
  • 9,902
  • 13
  • 71
  • 96
13
votes
1 answer

Doctrine 2 - Multiple databases configuration and use

I have a Symfony2 project with a MySQL db: #app/config/config.yml doctrine: dbal: driver: %database_driver% # < host: %database_host% # | port: %database_port% # | Defined in dbname: …
Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
13
votes
3 answers

How to allow a checkbox to be empty in symfony?

I have defined the following variable within an entity in my application. I have this, among other fields that can be updated via a form interface and I wish to be able to check and uncheck this box on that form. I can check the box and submit the…
Squazic
  • 3,670
  • 3
  • 26
  • 40