views:

478

answers:

3

Doctrine 1.2 has a method called generateModelFromDb, documented here, that generates model files for all of the tables in a database.

This function accepts an optional third parameter with an array of "options" to use when generating models, the specifics of which are not documented. What options are available for me to specify here?

A: 

The best I've seen is this:

http://www.doctrine-project.org/documentation/manual/1_2/ru/defining-models

... where you can try glean off the page any data type-specific "options". I haven't come across anything more comprehensive than that. The API documentation seems to assume that it's obvious what the possible options are.

Tom
A: 

This looks promicing: from here

// Generate your models from an existing database Doctrine::generateModelsFromDb('/path/to/generate/models', array('connection_name'), $options);

// Array of options and the default values $options = array('packagesPrefix' => 'Package', 'packagesPath' => '', 'packagesFolderName' => 'packages', 'suffix' => '.php', 'generateBaseClasses' => true, 'baseClassesPrefix' => 'Base', 'baseClassesDirectory' => 'generated', 'baseClassName' => 'Doctrine_Record');

Chris
+3  A: 

The complete list with default values from Doctrine/Import/Schema:

protected $_options = array('packagesPrefix'        =>  'Package',
                            'packagesPath'          =>  '',
                            'packagesFolderName'    =>  'packages',
                            'suffix'                =>  '.php',
                            'generateBaseClasses'   =>  true,
                            'generateTableClasses'  =>  false,
                            'generateAccessors'     =>  false,
                            'baseClassPrefix'       =>  'Base',
                            'baseClassesDirectory'  =>  'generated',
                            'baseClassName'         =>  'Doctrine_Record');
BenV