Skip to main content
Filter by
Sorted by
Tagged with
475 votes
8 answers
649k views

How to update a single library with Composer?

I need to install only 1 package for my SF2 distribution (DoctrineFixtures). When I run php composer.phar update I get - Updating twig/twig (dev-master 39d94fa => v1.13.0) The package ...
Tool's user avatar
  • 12.4k
386 votes
24 answers
604k views

Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

I am trying to add HWIOAuthBundle to my project by running the below command. composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle HWIOAuthBundle github: https://github....
Brian Chen's user avatar
  • 4,061
359 votes
2 answers
297k views

What is the difference between .yaml and .yml extension? [duplicate]

I read them on YAML-wikipedia but not really understood the main difference between them. I saw there are someone using .yaml extension, however, Symfony2 use .yml extension. YAML is a human-...
lvarayut's user avatar
  • 14.9k
264 votes
3 answers
202k views

On delete cascade with doctrine2

I'm trying to make a simple example in order to learn how to delete a row from a parent table and automatically delete the matching rows in the child table using Doctrine2. Here are the two entities ...
rfc1484's user avatar
  • 9,749
262 votes
41 answers
547k views

Running Composer returns: "Could not open input file: composer.phar"

I am new to symfony2 and reading symblog. In third chapter while trying with data-fixtures I tried the command: php composer.phar update but I got the error: Could not open input file: composer....
user3291745's user avatar
  • 2,679
250 votes
13 answers
229k views

How to get current route in Symfony 2?

How do I get the current route in Symfony 2? For example, routing.yml: somePage: pattern: /page/ defaults: { _controller: "AcmeBundle:Test:index" } How can I get this somePage value?
IlyaDoroshin's user avatar
  • 4,679
244 votes
12 answers
284k views

How to render a DateTime object in a Twig template

One of my fields in one of my entities is a "datetime" variable. How can I convert this field into a string to render in a browser? Here is a code snippet: {% for game in games %} ... &...
Chris Ridmann's user avatar
243 votes
11 answers
356k views

Count Rows in Doctrine QueryBuilder

I'm using Doctrine's QueryBuilder to build a query, and I want to get the total count of results from the query. $repository = $em->getRepository('FooBundle:Foo'); $qb = $repository->...
Acyra's user avatar
  • 16k
221 votes
16 answers
401k views

How to get the request parameters in Symfony 2?

I am very new to symfony. In other languages like java and others I can use request.getParameter('parmeter name') to get the value. Is there anything similar that we can do with symfony2. I have seen ...
Abdul Hamid's user avatar
  • 3,252
214 votes
5 answers
245k views

How to display string that contains HTML in twig template?

How can I display a string that contains HTML tags in a twig template? My PHP variable contains this HTML and text: $word = '<b> a word </b>'; When I do this in my twig template: {{ word }...
Gildas Ross's user avatar
  • 3,882
212 votes
7 answers
403k views

Get current URL in Twig template?

I looked around for the code to get the current path in a Twig template (and not the full URL), i.e. I don't want http://www.sitename.com/page, I only need /page.
Mark Cibor's user avatar
  • 2,797
208 votes
6 answers
32k views

Should everything really be a bundle in Symfony 2.x?

I'm aware of questions like this, where people tend to discuss the general Symfony 2 concept of bundle. The thing is, in a specific application, like, for instance, a twitter-like application, should ...
Daniel Ribeiro's user avatar
196 votes
8 answers
171k views

How do I read configuration settings from Symfony2 config.yml?

I have added a setting to my config.yml file as such: app.config: contact_email: [email protected] ... For the life of me, I can't figure out how to read it into a variable. I tried ...
josef.van.niekerk's user avatar
186 votes
8 answers
180k views

How to get config parameters in Symfony2 Twig Templates

I have a Symfony2 Twig template. I want to output the value of a config parameter in this twig template (a version number). Therefore I defined the config parameter like this: parameters: app....
Timo Haberkern's user avatar
159 votes
7 answers
220k views

How do I get the entity that represents the current user in Symfony?

I am using the Symfony security setup. Everything works fine, but I don't know how to do one important thing: In twig, I can reach the current user's info by doing: Welcome, {{ app.user.username }} ...
Robert Martin's user avatar

15 30 50 per page
1
2 3 4 5
4955