Author Archives: Van de Voorde Toni

How to use a symfony 1 layout from a different directory

In symfony 1 it is possible to have different layouts for an application. But they all have to be put into the directory ‘myproject/apps/frontend/templates/’. But what if you want to use a layout from another location? Assume you make a … Continue reading

Posted in General, Layout, php, Tips and Tricks | Tagged , , , | Leave a comment

How to force symfony colors on windows with PuttyCyg?

Those of you who’re developing with symfony under windows will have noticed that, when running tasks in the command prompt, no colors are used. This is because the windows command prompt isn’t compatible with the color notation. Most of you … Continue reading

Posted in Framework, General, php, Symfony | Tagged , , , | 13 Comments

Tech Support Cheat Sheet

Oh so true … From xkcd

Posted in General | Leave a comment

Quartz: test a cron expression

Cron expressions in quartz can sometimes be difficult to test, especially when the cron is programmed to trigger after hours or days. Unless you want to wait that time, here is some snippet code you can use to test a … Continue reading

Posted in General | Tagged , | 5 Comments

Symfony Form: unsetAllFieldsExcept()

When creating forms in symfony which extends from a Base (ORM) class, you sometimes do not need all fields that Propel/Doctrine generates for you. If you want to remove them you have several ways to do so. 1. Unset the … Continue reading

Posted in General, php, Symfony | Tagged , , | 5 Comments

sfWidgetFormInputCheckbox unchecked bug

Ever tried to create a Symfony form with a check box input field, which by default should be unchecked ? No ? Well read on because it’s not that easy . This would be the code to print a check … Continue reading

Posted in General, php, Symfony | Tagged , , , | 13 Comments

PHP DOMDocument: Convert Array to Xml

Recently I start working on an export module to invoice applications. One of them uses a very simple xml structure (simple nodes without attributes etc.) and therefore I wanted to create this xml also in a very simple way: from … Continue reading

Posted in General, php | Tagged , , | 16 Comments

Symfony Forms Framework: Merge 2 forms

Recently I had to create a form to create/update users in our system. Some time ago we decided to save are users in 2 tables. The first table would contain all login information and the second his personal information. This … Continue reading

Posted in Framework, Languages, php, Symfony | Tagged , , , | 33 Comments

Symfony Forms Framework: Change validators at runtime.

Let’s say you have to make a user form with password fields. When you create the user you want the password fields to be required, but on an update the password fields should be optional because you don’t want the … Continue reading

Posted in Framework, php, Symfony | Tagged , , | 1 Comment

Storing multiple data in 1 database field with PHP serialize / unserialize

While the serialize/unserialize functions exists since the early PHP 4 version, I ignored its existence. I discovered it recently doing some research on how to store multiple data in 1 database field. Before continuing, keep in mind that it’s not … Continue reading

Posted in database, mysql, php | Tagged , , | 1 Comment