Feb 15
Digg
Stumbleupon
Technorati
Delicious

So does it worth?.. or do you still work with 1.0 branch?

Dear symfoniacs,

So symfony team had enough time since they released 1.2 in December to polish this version (not mentioning about 1.2.3 release) and published Jobeet manual. And we’ve finally decided that it’s time to completely switch to using 1.2 branch. We’ve already written about branches comparison and its advantages/disadvantages in our articles:

Give a try to Symfony 1.2

Buzz around 1.2 and how far is 1.3 ?

but now we’d like to send a message to guys who still not sure if it’s worth to switch to 1.2.
Our opinion – it’s quite painless and you really wont have to learn something new if you don’t want to do it.

Let us mention here though about a few things you may need to know.
So the first thing is new command line syntax. This will be a small challenge if you only used 1.0 branch before. And to save your time here is a few commands you’ll have for sure to use.

So instead of old: symfony new project_name you must use now:

symfony generate:project project_name

and the same way you’d have to use generate:app, generate:module etc
Another command you will use often for sure is (old style: symfony propel build-all-load):

symfony propel:build-all-load –no-confirmation

where last –no-confirmation for silent database re-generation. And your favorite command to clean cache “symfony cc” can be used with the same syntax without changes.

Next difference is admin generator. It’s big and small difference though. You have now a lot of awesome features without actual big changes in syntax. In fact, it’s almost the same, here is the sample:


generator:
class: sfPropelGenerator
param:
model_class: MyModule
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: my_module
with_propel_route: 1

config:
actions: ~
fields: ~
list:
title: My Module List
display: [ name, email, updated_at ]
filter: ~
form: ~
edit: ~
new: ~

So as you can see there are some small differences but they are mostly about new functionality. So if you knew how to use admin generator – you can keep using it in the same manner.

We’d like to mention here about non obvious stuff about admin generator. Now when you use admin module generation command (which is symfony propel:generate-admin backend my_module –module=myModule) it will add new route commands to your config/routing.yml file. Also if you use Propel in your symfony project when you create new project it adds symbolic link to propel plugin images/css files in your web folder.

And the last difference we would like to mention here is using of stand-alone php files (either web/index.php or batch files). Symfony 1.2 requires different syntax for loading itself and it looks like this:


require_once(dirname(__FILE__) . '/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
sfContext::createInstance($configuration);

$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();

So we believe with this little help you can switch to 1.2 immediately and wont face any significant problems.

Take care!


Author: symfonian

2 Comments

Massimiliano Arione
February 16, 2009

I would point out that old “batch” files are now handled with “tasks”, with a dedicated task (symfony generate:task) to create a skeleton, and many benefits from parent task class.

Colnector
March 1, 2009

When you write “Our opinion – it’s quite painless and you really wont have to learn something new if you don’t want to do it.”

It doesn’t seem like there’s a really good reason to move.

I’m still using 1.1 on my site (http://colnect.com) and am generally very happy with it.

Are there are significant advantages to 1.2 that should make me move?

Comments RSS TrackBack Identifier URI

Leave a comment