Speed up Symfony by installing APC on Ubuntu
APC (Alternative PHP Cache) is an open source code PHP code cache and optimizer (or code accelerator). It is a necessary companion to any Symfony project.
sfDoctrine Behavior: Unique Random Column
I wanted a Symfony doctrine behavior / template to add a column that contains unique random string. I searched around but found nothing, so I developed these doctrine behavior / template for generating unique random string.
Symfony 1.2 sfForm formatter to add stars on required fields
The following is a form formatter class I developed to automatically add stars * on required fields. Feel free to use it and let me know if it can be improved.
You might ask, why not just use setLabels?
Firstly, if you already set required fields to true/false in setValidators, why do you have to add the stars manually again in setLabels? It just doesn't make sense!
Secondly, using setLabels to add stars is interfering with language translation.
Thirdly, this is I believe a proper (or proper-ish?) way to do this kind of things with sfForm.
Symfony redirect vs forward
I have not read a lot of articles on this but I did a quick Google search and found that all of the few articles I read seems to suggest redirect over forward. But I have a different opinion here, I would suggest that forward is better than redirect in most (if not all) cases.
2009 Symfony Developers Survey Results
Symfonynerds' 2009 Symfony Developers Survey Results is out! If you are a Symfony Developer and have not completed this survey, you could still do that, click here.
Most developers went straight from Symfony 1.0 to 1.2 and skipped 1.1 Propel is the dominant ORM framework, which is interesting in light of the recent announcement that Doctrine will be the default ORM framework in Symfony 1.3 and moving forward. Ubuntu is by far the most popular platfrom Symfony developers choose to run their applications on The question with the most evenly spread results is “How long have you been developing Symfony applications for” (see question 6). Indicating the community has a wide range of experience with lots of people under one year experience and many over two years experience. Most Symfony developers have never developed in another web application framework jQuery is by far the most popular library used with Symfony Eclipse PDT is the most popular IDE for Symfony developers No surprises here: Most Symfony developers are from Europe (which saddens us Aussies - we need more Aussie Symfony developers!) There were no developers that took the survey indicated they run Symfony applications on Oracle and MSSQL. MySQL was the most popular database used by far.
In regards to location of Symfony developers, there are few of us here in New Zealand! Too bad the survey did not have option for New Zealand or South pacific. I can't remember what I selected, could be Australia or Asia.
Symfony 1.2, Propel, and sfGuardPlugin: email login
This is a step by step on how to implement email login (login using email instead of username) using Symfony 1.2, Propel, and sfGuardPlugin. If you use Symfony 1.0, or want to know some background story, read Implementing email login with sfGuardPlugin.
This article assumes you have installed sfGuardPlugin.
Symfony Deployment Cheat Sheet
Symfony Deployment Cheat Sheet at symfony-check.org is a website with a very handy list of things to check for Symfony project in live server.
Go to the website for the details but here's the summary of the handy list:
- Customise the 'Oops! Page Not Found" page
- Customise the "Website Temporarily Unavailable"page
- Customise the "Oops! An Error Occurred" page
- Customise the "Login Required" page
- Customise the "Credentials Required" page
- Customise the "This Module is Unavailable" page
- Add a favicon
- Rename the session cookie
- Check the configuration of the production server
- Customise the language of your pages
- Delete "/backend.php" from your uri
- Install a PHP Accelerator
- Log errors in the production environment
- Customise rsync_exclude.txt
- Escape your templates
- Protect your forms
- Redirect to the unavailable screen during the maintenance operations
Thank you for the list UI Studio (BTW UI Studio, you didn't do item #7!) and happy deploying y'all :)
Implementing email login with sfGuardPlugin
(* Update: This article is for Symfony 1.0, for Symfony 1.2 implementation go to Symfony 1.2, Propel, and sfGuardPlugin: email login)
Most of us use sfGuardPlugin with Symfony Framework for user management (login stuffs). It is a great, popular, and de facto plugin for doing user management in Symfony.
Here's the thing, by default, sfGuardPlugin does login using usernames, not emails. But for many projects, it is preferable and more suitable to use email for login.
In this article I would like to discuss a way to implement email login using Symfony. I've only tried this in Symfony 1.0, but this might/should work on 1.1 and 1.2. And I would be very interested to know your experience if you try this method on Symfony 1.1 or Symfony 1.2
How to do SUM with Propel
http://www.digitalbase.eu/blog/simplifying-queries-using-sum-count-etc-in-propel/
$c->addSelectColumn('sum('.dbTimeBlockPeer::TOTAL.') as total');
$rs = dbTimeBlockPeer::doSelectRS($c);
while ($rs->next()) { $total = $rs->getInt(1); }
How to add a captcha field in Symfony 1.1
Step by step on how to add a captcha field to a Symfony 1.1 form.