September 11th, 2007
This is a simple how-to that describes adding callbacks for Propel models in symfony project
(like those usefull methods in ActiveRecord::Callbacks module).
Step 1 : Enable Propel behaviors in config/propel.ini
|
propel.builder.AddBehaviors = true // Default value is false |
Step 2 : Register the callback method and define it in model class - for example
lib/model/Page.php
1
2
3
4
5
6
7
8
9
|
class PageTab extends BasePageTab
{
function preSave(BaseObject $object, $con)
{
}
}
sfMixer::register('BasePageTab:save:pre', array('PageTab', 'preSave')); |
Step 3 : Rebuild the model
|
$ symfony propel-build-model |
There is much more detailed article on this topic by
François Zaninotto called
"Understanding Behaviors"
Leave a Reply