Symfony

Symfony2 – remember me cookies

Featured Image © hoefi@sxc.hu

When developing web services for mobile devices to handle user log-in, I had to make it persistent somehow, so the user should not log-in each time when starts mobile application, but I rather wanted log in to be permanent somehow while user does not log-out manually.

Read more

Symfony2 DBAL QueryBuilder

Featured Image © ba1969@sxc.hu

Sometimes, when we have some relatively complex queries to write, it’s so long and inflexible statement that it’s pretty hard to understand few days after we wrote it, or we have to add some dynamic parameters or conditions that writing plain DBAL statement could be real nightmare …

Read more

Symfony2 DBAL array parameters

Featured Image © wimster@sxc.hu

Few days ago I had to use DBAL statement that will execute SQL IN(somearray) statement.

Considering that I used Doctrine DBAL in this part of code, I had to find the proper way of doing it.
I wrote some basic things about using Doctrine DBAL inside Symfony2 project, but I didn’t ever need this one before until now …

Read more

Symfony2 global variables in TWIG

Featured Image © personalfx@sxc.hu

Except well documented TWIG functions like: path(),  asset(), … and custom variables you pass into view from controller when rendering some TWIG template, Symfony2 provides an easy way to access some ‘global’ variables inside TWIG templates without explicitly sending those to the view from controller.

Read more

Symfony2 REST – reading data from PUT request

Featured Image © Yello-Dog@sxc.hu

I know that this is not so advanced theme to write about, but let me write few articles about little things that can bother developers and take time for searching and googling.

This article is mostly general php and not strictly Symfony2, but sometimes you will find this useful in your project.

Just to be clear: there is native Symfony 2 way to do that with using:

$request->get('key')

and I am going to explain other possibilities here…

Read more

Creating simple Symfony2 service

Featured Image

I am not talking about web services, but I am talking about symfony2 service container and the way of basic creating services inside Symfony2 project that are accessible from all other bundles via service container.

Why do I need to make some part of code like service inside Symfony2 anyway?

There is one possible problem:

Read more