Example #1
0
 protected function addClassClose(&$script)
 {
     parent::addClassClose($script);
     $behavior_file_name = 'Base' . $this->getTable()->getPhpName() . 'Behaviors';
     $behavior_file_path = $this->getFilePath($this->getStubObjectBuilder()->getPackage() . '.om.' . $behavior_file_name);
     $absolute_behavior_file_path = sfConfig::get('sf_root_dir') . '/' . $behavior_file_path;
     if (file_exists($absolute_behavior_file_path)) {
         unlink($absolute_behavior_file_path);
     }
     $behaviors = $this->getTable()->getAttribute('behaviors');
     if ($behaviors) {
         file_put_contents($absolute_behavior_file_path, sprintf("<?php\nsfPropelBehavior::add('%s', %s);\n", $this->getTable()->getPhpName(), var_export(unserialize($behaviors), true)));
         $script .= sprintf("\n\ninclude_once '%s';\n", $behavior_file_path);
     }
 }