Add simple behavior with Propel / Symfony

Add your behavior in a new file in :


Edit SfPropelBehaviorSymfony.php and add a loader for your new Behavior. Example :

public function modifyDatabase()
foreach ($this->getDatabase()->getTables() as $table)
$behaviors = $table->getBehaviors();


// MyBehavior
if (!isset($behaviors[‘symfony_mybehavior’]))

$class = Propel::importClass($this->getBuildProperty(‘propel.behavior.symfony_mybehavior.class’));
$behavior = new $class();


Edit config/propel.ini and add a new line with your new behavior

Rebuild your full models and enjoy !

Leave a Reply

Your email address will not be published. Required fields are marked *