Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Not generating Doctrine_Record_Generator generations on every request
- ---------------------------------------------------------------------
- In one of my Doctrine_Template_*, I recoded the ->generateClassFromTable() method.
- */
- public function generateClassFromTable(Doctrine_Table $table)
- {
- if(sfConfig::get('sf_environment') == 'prod')
- {
- $class = $table->getComponentName();
- $record = new $class();
- }
- else
- {
- $definition = array();
- $definition['columns'] = $table->getColumns();
- $definition['tableName'] = $table->getTableName();
- $definition['actAs'] = $table->getTemplates();
- $definition['relations'] = $table->getRelations();
- //this code is to generate the Plugin* file in the correct path
- //so any plugin model should add a package: information somewhere in the config
- //of the behavior.
- //This is not really related to our problem
- if(isset($this->model['package']))
- {
- $definition['package'] = $this->model['package'];
- $definition['package_custom_path'] = str_replace('.', DIRECTORY_SEPARATOR, $definition['package']);
- }
- $this->_options['generatePath'] = 'lib/model/doctrine';
- return $this->generateClass($definition);
- }
- }
Add Comment
Please, Sign In to add comment