[?php <?php echo dinGeneratorSigner::getHeader() . "\n"; ?> /** * Form class for <?php echo $this->table->getOption('name'); ?> object * * @package <?php echo dinGeneratorSigner::getProjectName() . "\n"; ?> * @subpackage lib.form.doctrine * @author <?php echo dinGeneratorSigner::getAuthor() . "\n"; ?> */ class <?php echo $this->table->getOption('name'); ?> Form extends Base<?php echo $this->table->getOption('name'); ?> Form { /** * Configure form
/** * Replace tokens in project model classes * * @param string $libDir Base directory for model classes * @param string $model Model name * @param string $package Package name * @param string $suffix Suffix for class files * @param boolean $isPlugin Is plugin model classes pair [optional, default false] * @return void */ protected function replaceLibClasses($libDir, $model, $package, $suffix, $isPlugin = false) { // record class file $recFile = $libDir . ($isPlugin ? 'Plugin' : '') . $model . $suffix; $code = str_replace("\r\n", "\n", file_get_contents($recFile)); $eol = "\n"; $pt = '|/\\*\\*' . $eol . ' \\* ([\\w]+)' . $eol . ' \\* ' . $eol . ' \\* This class has been auto-generated by the Doctrine ORM Framework' . $eol . ' \\* ' . $eol . ' \\* @package ##PACKAGE##.* \\*/|Uumsi'; preg_match($pt, $code, $m); if ($m) { $header = ($isPlugin ? dinGeneratorSigner::getPluginHeader($package) : dinGeneratorSigner::getHeader()) . $eol . $eol . '/**' . $eol . ' * ' . ($isPlugin ? 'Plugin c' : 'C') . 'lass that represents a record of ' . $model . ' model' . $eol . ' * ' . $eol . ' * @package ' . ($isPlugin ? $package : dinGeneratorSigner::getProjectName()) . $eol . ' * @subpackage lib.model.doctrine' . (!$isPlugin && $package ? '.' . $package : '') . $eol . ' * @author ' . dinGeneratorSigner::getAuthor() . $eol . ' */'; $code = str_replace($m[0], $header, $code); $pt = '|class ([\\w]+) extends ([\\w]+)' . $eol . '{' . $eol . $eol . '}|Uumsi'; preg_match($pt, $code, $m); if ($m) { $cont = 'class ' . ($isPlugin ? 'Plugin' : '') . $model . ' extends ' . ($isPlugin ? 'Base' : 'Plugin') . $model . $eol . '{' . $eol . '} // ' . ($isPlugin ? 'Plugin' : '') . $model . $eol . $eol . '//EOF'; $code = str_replace($m[0], $cont, $code); } file_put_contents($recFile, $code); } // table class file $tblFile = $libDir . ($isPlugin ? 'Plugin' : '') . $model . 'Table' . $suffix; $code = str_replace("\r\n", "\n", file_get_contents($tblFile)); $pt = '|/\\*\\*' . $eol . ' \\* ([\\w]+)' . $eol . ' \\* ' . $eol . ' \\* This class has been auto-generated by the Doctrine ORM Framework' . $eol . ' \\*/|Uumsi'; preg_match($pt, $code, $m); if ($m) { $header = ($isPlugin ? dinGeneratorSigner::getPluginHeader($package) : dinGeneratorSigner::getHeader()) . $eol . $eol . '/**' . $eol . ' * ' . ($isPlugin ? 'Plugin c' : 'C') . 'lass for performing query and update operations for ' . $model . ' model table' . $eol . ' * ' . $eol . ' * @package ' . ($isPlugin ? $package : dinGeneratorSigner::getProjectName()) . $eol . ' * @subpackage lib.model.doctrine' . (!$isPlugin && $package ? '.' . $package : '') . $eol . ' * @author ' . dinGeneratorSigner::getAuthor() . $eol . ' */'; $code = str_replace($m[0], $header, $code); $pt = '|class ([\\w]+) extends ([\\w]+)' . $eol . '{' . $eol . ' /\\*\\*' . $eol . ' \\* Returns an instance of this class\\.' . $eol . ' \\*' . $eol . ' \\* @return object ([\\w]+)' . $eol . '.* }' . $eol . '}|Uumsi'; preg_match($pt, $code, $m); if ($m) { $cont = 'class ' . ($isPlugin ? 'Plugin' : '') . $model . 'Table extends ' . ($isPlugin ? $m[2] : 'Plugin' . $model . 'Table') . $eol . '{' . $eol . $eol . ' /**' . $eol . ' * Returns an instance of ' . ($isPlugin ? 'Plugin' : '') . $model . 'Table' . $eol . ' * ' . $eol . ' * @return ' . ($isPlugin ? 'Plugin' : '') . $model . 'Table' . $eol . ' */' . $eol . ' public static function getInstance()' . $eol . ' {' . $eol . $eol . " return Doctrine_Core::getTable( '" . ($isPlugin ? 'Plugin' : '') . $model . "' );" . $eol . $eol . ' } // ' . ($isPlugin ? 'Plugin' : '') . $model . 'Table::getInstance()' . $eol . $eol . '} // ' . ($isPlugin ? 'Plugin' : '') . $model . 'Table' . $eol . $eol . '//EOF'; $code = str_replace($m[0], $cont, $code); } file_put_contents($tblFile, $code); } }