Questions tagged [symfony-2.3]

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

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

Information

This tag is specific for the 2.3 version of Symfony, which was released on the 3 June 2013 as the first LTS version of Symfony. See the tag for general Symfony 2.x questions.

As of 11 June 2013, the latest stable release of Symfony 2.3 is version 2.3.1.

Living on the edge

There are a set of interesting links on the symfony blog about what's new in this version:

Useful links

771 questions
156
votes
8 answers

How do I read from parameters.yml in a controller in symfony2?

I have put a couple of custom variables in my app/config/parameters.yml. parameters: api_pass: apipass api_user: apiuser I need to access these from my controller, and have tried to fetch them with $this->get('api_user'); from within my…
Bohr
  • 2,086
  • 3
  • 15
  • 19
38
votes
8 answers

Call PHP function from Twig template

I have a function in my controller that returns array of entities so in my twig template I do this to iterate over elements: {% for groupName, entity in items %}
      {% for element in entity %}
    • {{…
Reynier
  • 2,420
  • 11
  • 51
  • 91
37
votes
4 answers

How to give container as argument to services

in my services constructor public function __construct( EntityManager $entityManager, SecurityContextInterface $securityContext) { $this->securityContext = $securityContext; $this->entityManager = $entityManager; I pass…
whitebear
  • 11,200
  • 24
  • 114
  • 237
30
votes
1 answer

How does the login check_path route work without default controller/action?

I am working on symfony 2.3 project having the following routing code just2_frontend_logincheck: pattern: /login_check It doesn't have defaults:{ _controller: testBundle:User:login } But it is working. But I don't know how the routing is…
saravanan
  • 401
  • 1
  • 4
  • 11
30
votes
3 answers

Symfony2 -> Twig -> Form -> Field -> Set rendered = true

i have a simple problem. I have a form with a field for example: $builder ->add('x') ->add('y') ->add('z') ; In my twig files i used multiple blocks and i want to stop render fields... I view the b.html.twig file! a.html.twig {% block…
PatrickB
  • 3,225
  • 5
  • 31
  • 55
28
votes
1 answer

Symfony2 - form_start function customise in twig

Form helpers form_start and form_end are useful in twig: {{ form_start(form) }} {{ form_end(form) }} I can customise some parameters like the method or the action. But I need to customise others parameters like the class or add the…
Roberto Rizzi
  • 1,525
  • 5
  • 26
  • 39
25
votes
4 answers

How to change form field value in symfony 2

I have a form like below: class ItemType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder // ... ->add('tags','text',array( 'required'…
dextervip
  • 4,999
  • 16
  • 65
  • 93
23
votes
0 answers

Set default values using form classes in Symfony 2

I am trying to define a default value for a text field in Symfony 2.3. The form is used both for creating and updating the entity. In edit mode the value given by the database should be used, not the default (of course). Edit This seems to be a…
herrjeh42
  • 2,782
  • 4
  • 35
  • 47
22
votes
1 answer

Forgot password function fosuserbundle

I have been googling for a couple hours now and cannot find any information on how to implement the "Forgot Password" functionality in FOSUserBundle Is this part of the bundle or is it something I have to create myself.
smugford
  • 769
  • 2
  • 10
  • 20
17
votes
4 answers

How can i get the absolute url of route with symfony

I am using symfony and I want to get the url of a specific route , my route is like this project_sign_in: pattern: /signin defaults: { _controller: ProjectContactBundle:User:signIn } i want to generate the url from this route so i can get…
user2784013
  • 253
  • 1
  • 5
  • 14
16
votes
2 answers

Stop SonataAdmin / Symfony2 from creating empty objects with sonata_type_admin embedded admins

First of all, I'm not sure if this is a Sonata issue or a Symfony2 one, this is the first time I'm working with Sf2 forms to edit a relationship. Here's the problem: I have two classes, let's call them the old favourites: Car and Wheel. Car has an…
caponica
  • 3,788
  • 4
  • 32
  • 48
14
votes
1 answer

Specify different validation groups for each item of a collection in Symfony 2?

[Documentation about collection] When embedding forms (collection type) is possible to specify validation groups for each item, based on the current item? It seems not working ATM. The TaskType form adding a collection of tags: //…
gremo
  • 47,186
  • 75
  • 257
  • 421
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
2 answers

upgrade from symfony 2.0 to 2.3

I already have running project which is in Symfony 2.0.10. But now I need to upgrade it to Symfony 2.3.I know there is need to change some code to compitable with latest version.Is there any command to upgrade? Or what is the exact procedure to…
stefun
  • 1,261
  • 3
  • 24
  • 54
13
votes
3 answers

Symfony - How to access entity's repository

There are several ways that we can access the entity's repository in Symfony2 controllers or services which each has its advantage and disadvantage. First I list them here and then asking if there is any better solution or these are the only options…
Saman
  • 5,044
  • 3
  • 28
  • 27
1
2 3
51 52