puttering around with Symfony
Wednesday, January 23rd, 2008On advice from Nate, I'm taking Symfony for a spin (using the stable version 1, not the under-development 1.1), reimplementing the aforementioned contact management application. Here's what I'm noticing:
- Somewhat like Rails, there's DB-independent schema definition! Big win here. Among other things, this lets you develop in SQLite and deploy in MySQL, which is a nice pattern. Rails' awesome migrations aren't here, so it's not as useful and flexible a system, but it's better than nothing for getting up & running.
- One big difference from Rails that's clear right away: rather than building code dynamically based on the DB schema, thousands of lines of getters / setters / etc. are generated by the symfony command line tool. Makes sense for PHP, but it's a clunkier development experience.
- There's testing built in! It's a bit of a PITA to do things like create a test database, and all the pieces for testing your models aren't there right away, but still better than CakePHP. The aforementioned missing piece is available as a plugin. There doesn't seem to be a straightforward way to get the
propel-insert-sqltask to run on alternate environments, so one must create the db on their own. I'm using SQLite, which is great, but my local environment somehow ended up with PHP having SQLite 2.8 while my command line is version 3 (macports at fault? what a step backwards from Ubuntu...). Oneport install sqlite2later, and you can dosqlite data/test.db < data/sql/lib.model.schema.sql - No console, which makes the tests even more essential, so it does seem to be worth the pain of getting them working.
Side note -- already, on the basis of the previous post, I'm seeing a surprising amount of traffic from searches on CakePHP, Symfony, and REST. Clearly I'm not the only one looking for this kind of thing.