Monthly Archives: November, 2011

Disable csrf protection in Symfony

Disable LOCAL csrf protection

In order to disable CSRF for just *this* form, inside the form configure() method add following code

$this->disableLocalCSRFProtection();

Disable GLOBAL csrf protection

It might also happen that you want to quickly disable CSRF protection for all forms you have, you can do this using static method disableCSRFProtection() on sfForm.

sfForm::disableCSRFProtection()

Combining two fields data into one field in the same database table

If you only want to display the name after combining the fields then simply use:
SELECT CONCAT(first_name, ‘ ‘, last_name) AS full_name FROM table_name;

But if you want to save them in a separate db field then use UPDATE query. To update all the records in the table in one shot use:

UPDATE table_name SET full_name = CONCAT(first_name, ‘ ‘, last_name);