Changeset 9534
- Timestamp:
- 06/11/08 10:22:45 (2 years ago)
- Files:
-
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php (modified) (1 diff)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php (modified) (2 diffs)
- branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php
r7394 r9534 347 347 $script .= $tmp; 348 348 } 349 349 350 350 protected function addClassClose(&$script) 351 351 { 352 352 parent::addClassClose($script); 353 353 354 354 $behaviors = $this->getTable()->getAttribute('behaviors'); 355 if ($behaviors)355 if ($behaviors) 356 356 { 357 357 $behavior_file_name = 'Base'.$this->getTable()->getPhpName().'Behaviors'; 358 358 $behavior_file_path = $this->getFilePath($this->getStubObjectBuilder()->getPackage().'.om.'.$behavior_file_name); 359 $script .= sprintf("\n\ninclude_once '%s';\n", $behavior_file_path); 360 } 361 } 359 360 $behavior_include_script = <<<EOF 361 362 363 if (ProjectConfiguration::getActive() instanceof sfApplicationConfiguration) 364 { 365 include_once '%s'; 362 366 } 367 368 EOF; 369 $script .= sprintf($behavior_include_script, $behavior_file_path); 370 } 371 } 372 } branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php
r8807 r9534 384 384 $script .= $tmp; 385 385 } 386 386 387 387 protected function addClassClose(&$script) 388 388 { … … 392 392 $behavior_file_path = $this->getFilePath($this->getStubObjectBuilder()->getPackage().'.om.'.$behavior_file_name); 393 393 $absolute_behavior_file_path = sfConfig::get('sf_root_dir').'/'.$behavior_file_path; 394 395 if (file_exists($absolute_behavior_file_path))394 395 if (file_exists($absolute_behavior_file_path)) 396 396 { 397 397 unlink($absolute_behavior_file_path); 398 398 } 399 399 400 400 $behaviors = $this->getTable()->getAttribute('behaviors'); 401 if ($behaviors)401 if ($behaviors) 402 402 { 403 403 file_put_contents($absolute_behavior_file_path, sprintf("<?php\nsfPropelBehavior::add('%s', %s);\n", $this->getTable()->getPhpName(), var_export(unserialize($behaviors), true))); 404 $script .= sprintf("\n\ninclude_once '%s';\n", $behavior_file_path); 404 405 $behavior_include_script = <<<EOF 406 407 408 if (ProjectConfiguration::getActive() instanceof sfApplicationConfiguration) 409 { 410 include_once '%s'; 411 } 412 413 EOF; 414 $script .= sprintf($behavior_include_script, $behavior_file_path); 405 415 } 406 416 } branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
r9132 r9534 82 82 { 83 83 $this->table = $table; 84 85 try86 {87 // trigger the include_once of any behaviors now, and catch the88 // exception that is thrown due to no plugin behaviors having been89 // registered90 class_exists($table->getPhpName());91 }92 catch (sfConfigurationException $e)93 {94 }95 84 96 85 // find the package to store forms in the same directory as the model classes

