Development

Changeset 8020 for trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php

You must first sign up to be able to contribute.

Show
Ignore:
Timestamp:
03/21/08 11:01:15 (6 months ago)
Author:
fabien
Message:

merged 1.1 branch changes (to r8006)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php

    r7131 r8020  
    382382    $script .= $tmp; 
    383383  } 
     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  } 
    384405}