Ticket #3476: propel-build-forms-behaviors-v2.patch
| File propel-build-forms-behaviors-v2.patch, 3.2 kB (added by Kris.Wallsmith, 5 months ago) |
|---|
-
lib/plugins/sfPropelPlugin/lib/propel/builder/SfPeerBuilder.php
old new 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 394 395 if (file_exists($absolute_behavior_file_path))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 } 407 417 -
lib/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php
old new 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); 359 360 $behavior_include_script = <<<EOF 361 362 363 if (ProjectConfiguration::getActive() instanceof sfApplicationConfiguration) 364 { 365 include_once '%s'; 366 } 367 368 EOF; 369 $script .= sprintf($behavior_include_script, $behavior_file_path); 360 370 } 361 371 } 362 372 } -
lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelFormGenerator.class.php
old new 82 82 { 83 83 $this->table = $table; 84 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 96 85 // find the package to store forms in the same directory as the model classes 97 86 $packages = explode('.', constant($table->getPhpName().'Peer::CLASS_DEFAULT')); 98 87 array_pop($packages);