Exemple #1
0
 protected function addDoUpdate(&$script)
 {
     $tmp = '';
     parent::addDoUpdate($tmp);
     if (DataModelBuilder::getBuildProperty('builderAddBehaviors')) {
         // add sfMixer call
         $pre_mixer_script = "\n\n    foreach (sfMixer::getCallables('{$this->getClassname()}:doUpdate:pre') as \$callable)\n    {\n      \$ret = call_user_func(\$callable, '{$this->getClassname()}', \$values, \$con);\n      if (false !== \$ret)\n      {\n        return \$ret;\n      }\n    }\n\n";
         $post_mixer_script = "\n\n    foreach (sfMixer::getCallables('{$this->getClassname()}:doUpdate:post') as \$callable)\n    {\n      call_user_func(\$callable, '{$this->getClassname()}', \$values, \$con, \$ret);\n    }\n\n    return \$ret;\n";
         $tmp = preg_replace('/{/', '{' . $pre_mixer_script, $tmp, 1);
         $tmp = preg_replace("/\t\treturn ([^}]+)/", "\t\t\$ret = \$1" . $post_mixer_script . '  ', $tmp, 1);
     }
     $script .= $tmp;
 }