In this new installment of "Small things matter", I will yet again talk about things that makes symfony easier for newcomers and more flexible for advanced users.
sfViewCacheManager
The symfony cache layer has always been quite configurable but lacked some flexibility.
As of symfony 1.2, the view cache manager class can be configured in factories.yml
and default
to sfViewCacheManager
:
view_cache_manager: class: sfViewCacheManager
Forms
The new form framework introduced in symfony 1.1 was a bit rough around the edges, and each week, we try to make it easier to use for the web designer and the developer.
This time, thanks to François's work on the documentation, we have added a way to declare widget default values and labels directly in the widget declaration:
class SomeForm extends sfForm { public function configure() { $this->setWidgets(array( 'first_name' => new sfWidgetFormInput(array( 'label' => 'Your first name', 'default' => 'Enter your first name here' )); )); // ... } }
Propel
I have already talked about the propel:insert-sql
task in a previous post,
but this task has been yet again enhanced, and not in a small way.
Before symfony 1.2, the propel:insert-sql
task was the only task to read its
database configuration information from propel.ini
. It was a pain in the ass
for several reasons:
- You have to remember to update the
propel.ini
file each time you modifydatabases.yml
- The
propel.ini
file has no way to declare different configurations for different connections or environments. - As a result, most of the time, you are obliged to update
propel.ini
manually each you want to usepropel:insert-sql
; or perhaps pragmatically you insert the SQL statements fromdata/sql
by hand like I do.
That's over! As of symfony 1.2, the propel:insert-sql
task reads its
information from databases.yml
. So, if you use several different
connections in your model, the task will take those into account
automatically.
You can even use the --connection
option if you want to only load
SQL statements for a given connection:
$ php symfony propel:insert-sql --connection=propel
Or use the --env
and/or the --application
options to select a
specific configuration to use:
$ php symfony propel:insert-sql --env=prod --application=frontend
You can of course mix and match all those options.
symfony 1.2 is coming along nicely and I really hope you will enjoy it as much as I do.
The replacement of the old propel.ini behavior is great. What's the status of Propel databases migrations?
I lack the functionality of sfProcessCahce as it is in symfony 1.0. I still use it with symfony 1.2 from sfCompat10Plugin. What are the plans with sfProcessCache?
@Gunt: Kris is working hard on the Propel migration feature. We will try to include it in 1.2. If not, it will be in 1.3
@adrive: The sfProcessCache has been replaced in 1.1 with the sfAPCCache, sfEAccelerator, ... classes. What do you miss from the old class?