Skip to content
Advertisement

Tag: symfony

symfony2 get command line executed

I am creating a console command in symfony2. I need to log an executed line i run. How to get that line? So if i run: I want to get value “php app/console my-command fileName.txt –myoption=100” Thanks for any help Answer I’m interpreting the question as: Within the Command code itself, you want to determine what was written on the

How to retrieve all Variables from a Twig Template?

Is it possible to retrieve all variables inside a Twig template with PHP? Example someTemplate.twig.php: Now I want to do something like this: $variables should now contain “name” and “email”. The reason I want to do this is that I am working on a CMS system where my twig templates and variables are dynamically set by my users and they

Symfony2 Accessing route variables

I know I can access current route name by $request->get(‘_route’);. If my route is defined this way: How can I retrieve the id variable from within service? Answer $request->attributes->get(‘id’) does the trick.

How can I send JSON response in symfony2 controller

I am using jQuery to edit my form which is built in Symfony. I am showing the form in jQuery dialog and then submitting it. Data is entering correctly in database. But I don’t know whether I need to send some JSON back to jQuery. Actually I am bit confused with JSON thing. Suppose I have added a row in

Getting all request parameters in Symfony 2

In symfony 2 controllers, every time I want to get a value from post I need to run: Is there any way to consolidate these into one statement that would return an array? Something like Zend’s getParams()? Answer You can do $this->getRequest()->query->all(); to get all GET params and $this->getRequest()->request->all(); to get all POST params. So in your case: For more

Symfony 2 dynamically change form based on a selected value

I have the following table: EventType can have a few values i.e check-in, checkout, room rent, misc, etc. I want to make a form that will change the field type of “Value” to text, date, or entity based on the selected type in “EventType”. I tried to find some solutions but didn’t succeed. The only thing I found is that

Advertisement