Questions tagged [symfony-2.1]

This is the Symfony 2.1.x specific tag. Use it in addition to the symfony2 tag if your question is specific to Symfony 2.1.x — not just 2.x.

Symfony is a PHP full-stack web framework developed and maintained by Sensio Labs.

As of May 2013, 2.1 is deprecated in favor of the newer versions.

Information

This tag is specific for the 2.1 version of Symfony, which has been released on the 6 September 2012. See the tag for general Symfony 2.x questions.

Symfony 2.1 code is hosted and versioned on github.

As of 2 June 2013, the latest stable release of Symfony 2.1 is version 2.1.11.

Useful links

1094 questions
15
votes
2 answers

Making configuration node support both string and array in Symfony 2 configuration?

Can my configuration node source support both string and array values? Sourcing from string: # Valid configuration 1 my_bundle: source: %kernel.root_dir%/../Resources/config/source.json Sourcing from array: # Valid configuration 2 my_bundle: …
gremo
  • 47,186
  • 75
  • 257
  • 421
15
votes
1 answer

Symfony2 global and optional locale detection from route

Here's what I want to achieve, followed by a compilation of the knowledge I acquired, with no solution. In a Symfony2 project, without using a dedicated bundle, I want the first directory in path to define the locale. It must be optional: 1.…
Ninj
  • 1,492
  • 1
  • 15
  • 27
15
votes
7 answers

Bundle "ApplicationSonataUserBundle" does not exist or it is not enabled

I need to install the SonataUserBundle to be able to install the SonataNewsBundle. I followed the installation Tutorial step by step but i got this error : ./app/console sonata:easy-extends:generate SonataUserBundle [InvalidArgumentException] …
skonsoft
  • 1,786
  • 5
  • 22
  • 43
14
votes
3 answers

Set Flash in Symfony 2.1

I have been adapting our code in preparation of moving our code to the new 2.1 Symfony codebase. In 2.0.* we could set Flash messages by simply calling the session service in our controller using the following $this->get('session')->setFlash('type',…
michaelotoole
  • 391
  • 2
  • 8
14
votes
2 answers

set validation group to embedded forms in symfony 2

how to set validation group in embedded forms ? I have two entities A and B and form for each entities (FormA, FormB) I am embedding form FormA in FormB class FormB extends AbstractType { public function buildForm(FormBuilderInterface $builder,…
sonam
  • 3,720
  • 12
  • 45
  • 66
14
votes
4 answers

How to inject non-default entity managers?

In Symfony2 you can work with multiple entity managers and use something like the code below: $em = $this->get('doctrine')->getManager(); $em = $this->get('doctrine')->getManager('default'); $customerEm = …
d0001
  • 2,162
  • 3
  • 20
  • 46
14
votes
7 answers

Symfony 2: 404 Not Found Error when tryes to open /app_dev.php

I am getting this error message when try to open /app_dev.php An error occurred while loading the web debug toolbar (404: Not Found). Do you want to open the profiler? When I click ok, I am getting then the…
Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265
14
votes
5 answers

Symfony2.1: Unable to find the controller for path "/login_check"

I used the "Using a traditional login form" tutorial from symfony.com to authentificate my users. With a simple http auth it works great. After the login was submitted I get this Exception: Unable to find the controller for path "/login_check".…
falsch
  • 1,425
  • 2
  • 14
  • 21
14
votes
3 answers

Unit testing custom validation constraint in Symfony 2.1 but without accessing the container?

How can i unit test ContainsItalianVatinValidator custom validator, but w*ithout accessing the container* and the validator service (and thus, create a stub object)? class ContainsItalianVatinValidator extends ConstraintValidator { /** *…
gremo
  • 47,186
  • 75
  • 257
  • 421
14
votes
3 answers

Where to register autoload when the vendor is not managed with composer in Symfony 2.1?

I'm using symfony 2.1 and I want to add a library to vendors. The library do not exists in packagist. I can't manage it with composer. When I install bundles or others vendors through composer, it manage autoload for me. But where to register…
smoreno
  • 3,129
  • 3
  • 32
  • 49
13
votes
2 answers

Symfony2 get validation constraints on an entity

Im working on a method to get all validation constraints of an entity (what i am trying to achieve is to return this data in JSON and apply the same constraints on client side using JQuery Validation Plugin), however im having some trouble getting…
Youssef
  • 1,033
  • 8
  • 16
13
votes
1 answer

How to use roles in SonataAdminBundle

I started to use SonataAdminBundle in a Symfony2.1 application. I developed all the Admin classes and now I wish to add roles to prevent view, list and edit actions to such user groups (e.g. non-admin users). Notice that I don't use the…
JeanValjean
  • 17,172
  • 23
  • 113
  • 157
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
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
12
votes
2 answers

Symfony get form data in controller

I have this view: //login.html.twig MY APP
SensacionRC
  • 595
  • 1
  • 13
  • 30
1 2
3
72 73