Doing UPDATE with Doctrine and a String as Parameter
Today I had to extend a few Doctrine queries and one of these modifications consisted of changing the parameter of an UPDATE query from integer to string – and whoops! It didn’t work anymore…
When using $query->getSql(); I noticed that it wanted to do something like this:
UPDATE data SET date = 2009-12-14 WHERE …
and of course [...]
Doctrine Queries
To create custom SQL queries in Symfony, one has to use Doctrine (no, I don’t go on a rant here why I don’t want to use Propel ^^) and its DQL (Doctrine Query Language). This can be a serious pain in the arse so let’s put up some quick examples:
$query = new Doctrine_Query();
Ok, now we [...]
Symfony: Allowing extra field in validated forms
A quick hint: it unnerves me when I have to add a new field to a Doctrine form that does not belong to the model and thus always fires a validator error. Since I don’t have time and don’t want to create a whole validator array for my rather big form, I used
$this->validatorSchema->setOption(’allow_extra_fields’, true);
to allow [...]
