This is an old trick, but I still find it useful and will post it here in case it will help other symfony developers out there. If you are using the prototype.js library for your ajax requests, the Ajax.Request (and similar) utility methods will automatically evaluate the server’s response as javascript if the response has the ‘text/javascript’ content-type header. More…
Status Updates
- First iPhone app nearly complete! I've been waiting for 3 weeks for Apple to finish "conducting company identity verification."
3 days ago - Rainy day! Staying indoors. Creating computerized players in a simulation game that models cooperation in the work place.
75 days ago - Up at 8AM, with a hot cup of coffee brought back from Cafe Lola in Ann Arbor. Will I succeed in putting in 8 billable hours in one day?
100 days ago - full scale irish band outside my window playing the pipes for the past 20 minutes. pretty fun.
109 days ago - listening to Kristin on Maxim Radio!
115 days ago - back from an amazing meal at ouest with even more amazing company.
115 days ago - wondering how so many online tshirt companies stay in business--ones that sell shirts with funny messages, i never see them in real life
122 days ago
RECENT TUNES
- Onra - INTRODUCTION
- of Montreal - Id Engager
- of Montreal - Mingusings
- of Montreal - Beware Our Nubile Miscreants
- of Montreal - Death Is Not A Parallel Move
- of Montreal - Plastis Wafers
- of Montreal - And I've Seen A Bloody Shadow
- of Montreal - Triphallus, to Punctuate!
- of Montreal - St.Exquisite's Confessions
- of Montreal - Women's Studies Victims
Symfony Articles
July 3, 2009 – 1:11pm Symfony: return javascript response
April 10, 2009 – 12:56pm symfony cache system: cache growing too large
Symfony has a really powerful cache mechanism, but if you turn it on and don’t configure it, it will cache one file for *every possible url*, and in the case of a dynamic site with thousands of pages, this grows to many gigabytes very fast. This is especially a problem if you have a dynamic search feature, and you have search-friendly URLS where you convert query parameters to /a/friendly/path/like/this. The number of unique paths that generate content on your site is literally infinite, since the URL can include anything the user types in the search box. More…
March 14, 2009 – 2:46pm Symfony Propel Enum types
Propel does not support enum column types in its schemas, since the enum type is not support across all database types. There are a few ways around this. More…
March 11, 2009 – 1:55am Symfony: How to render a partial from an action
If you ever find yourself wanting to return the contents of a partial as the entire response for an action, Symfony makes it possible. Using symfony partials with ajax, you have a lot of options of how you want to arrange your templates, but here I’ll show you what has worked best for me.
Oftentimes I find myself wanting to return the contents of a partial as the entire response for an ajax request. I do this a lot when I am already using a partial in my template, and then I want to replace that section with the results of an ajax call. We already have a partial set up to display that content, so we might as well reuse it when we have to refresh that area with new content. More…
January 23, 2009 – 4:42pm Uploading a file with Symfony 1.2
There is a post hidden within the symfony documentation that discusses how to upload a file using the new forms framework within symfony 1.2. If you are curious about the best way to handle file uploads, it’s worth reading this What’s New in Symfony 1.2 post first, and then come back here for a quick summary of how this works.
Let’s say you would like to allow users to upload PDF files to your site. You store data related to these file uploads in an “article” table in your database. This table has a column named “file” that stores the file name of the uploaded pdf.
The symfony forms framework will generate the basic (and not so basic) code to get you started. If you haven’t yet generated your form classes yet, you can do so with the command:
December 23, 2008 – 9:09pm Symfony 1.2: upload a file inside an embedded form
Symfony 1.1 introduced the ability to embed forms inside other forms. Symfony 1.2 enhanced this feature greatly by providing the ability to automatically save any related objects found within these nested forms (see this blog post). Another new feature introduced in 1.2. is the ability to automatically handle file uploads in forms. Basically if you have a propel object with a file field, and define this field in your form validation schema as an sfValidatorFile, symfony takes care of removing any old field, saving the new one, and updating the column in the object to reflect the new file name. Pretty sweet. (You can read more about this feature in What’s New in 1.2.)
Everything is nearly perfect, except one problem: File fields in embedded forms are *not* processed automatically. It took me a long time to track down the issue, but it was a good opportunity for me to explore some of the new sfForm framework and really get under the under to understand how it all works. More…
December 10, 2008 – 8:05pm Starting a new symfony project: Tips for sanity and bliss with SVN
There is something gratifying about starting a new project. You get to start fresh and it may be the only time during the project lifespan where everything is perfect.
Over time I’ve learned a few tricks that personally make my project environment a pleasure to work with. More…
February 29, 2008 – 1:45pm Propel Transactions with Symfony
It’s easy to create transactions with Propel. This can be very useful when you are deleting rows from your database from multiple tables, and want to do an “all or nothing” approach so that things don’t get messy. More…
January 24, 2008 – 4:48pm Propel Criteria Left Join: using addJoin() and addAlias() to join a table twice
Here is a way to do left join on two columns in a table that both were foreign keys in the same table using Propel. This might happen if for example you have a table with a parent_id and a child_id in a nested set that both refer to the same table, or as an example you have a table “documentation” and each documentation can be categorized into a main category and a sub category.
What happens when you want to do a left join in your documentation query, so that if present both the related category and sub_category objects get included in the results?
$c->addJoin(DocumentationPeer::CATEGORY, CategoryPeer::ID, Criteria::LEFT_JOIN); $c->addJoin(DocumentationPeer::SUB_CATEGORY, CategoryPeer::alias('c2', CategoryPeer::ID), Criteria::LEFT_JOIN); $c->addAlias('c2', CategoryPeer::TABLE_NAME);
Done and done!
January 24, 2008 – 4:37pm Installing Symfony on Leopard
I’ve found the best way to install symfony on Leopard is to use the version from SVN. I find this is easy to do, and easy to update in the future. Here is a cheat sheet for those looking to get up and running with symfony on their Mac running 10.5 Leopard. More…



