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
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
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
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
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
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
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
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