| | 384 | |
|---|
| | 385 | protected function addClassClose(&$script) |
|---|
| | 386 | { |
|---|
| | 387 | parent::addClassClose($script); |
|---|
| | 388 | |
|---|
| | 389 | $behavior_file_name = 'Base'.$this->getTable()->getPhpName().'Behaviors'; |
|---|
| | 390 | $behavior_file_path = $this->getFilePath($this->getStubObjectBuilder()->getPackage().'.om.'.$behavior_file_name); |
|---|
| | 391 | $absolute_behavior_file_path = sfConfig::get('sf_root_dir').'/'.$behavior_file_path; |
|---|
| | 392 | |
|---|
| | 393 | if(file_exists($absolute_behavior_file_path)) |
|---|
| | 394 | { |
|---|
| | 395 | unlink($absolute_behavior_file_path); |
|---|
| | 396 | } |
|---|
| | 397 | |
|---|
| | 398 | $behaviors = $this->getTable()->getAttribute('behaviors'); |
|---|
| | 399 | if($behaviors) |
|---|
| | 400 | { |
|---|
| | 401 | file_put_contents($absolute_behavior_file_path, sprintf("<?php\nsfPropelBehavior::add('%s', %s);\n", $this->getTable()->getPhpName(), var_export(unserialize($behaviors), true))); |
|---|
| | 402 | $script .= sprintf("\n\ninclude_once '%s';\n", $behavior_file_path); |
|---|
| | 403 | } |
|---|
| | 404 | } |
|---|