You are currently viewing the 1.0 branch api documentation. Switch to 1.1

1.0 Doctrine

Doctrine

Doctrine the base class of Doctrine framework

Method Summary

Returns Name Description
boolean autoload
compile
createDatabases
createTablesFromArray
createTablesFromModels
debug
dropDatabases
dump
dumpData
array filterInvalidModels This will inflect the class, causing it to be loaded in to memory.
generateMigrationClass
generateMigrationsFromDb
generateMigrationsFromModels
boolean generateModelsFromDb
generateModelsFromYaml
array generateSqlFromArray
string generateSqlFromModels
generateYamlFromDb This should probably be fixed. We should write something to generate a yaml schema file directly from the database.
generateYamlFromModels
getConnectionByTableName
array getLoadedModelFiles
array getLoadedModels Will filter through an array of classes and return the Doctrine_Records out of them. If you do not specify $classes it will return all of the currently loaded Doctrine_Records
string getPath
getTable
array initializeModels This will also inheritently initialize any model behaviors and add the models generated by Doctrine generators and add them to the $models array
boolean isValidModelClass
loadData The output of dumpData can be fed to loadData
loadModel
loadModels
bool migrate
__construct

Method Details

  • (boolean) autoload($className, $classname)

    simple autoload function returns true if the class was loaded, otherwise false


  • compile($target = null, $includedDrivers = array())

    Method for making a single file of most used doctrine runtime components including the compiled file instead of multiple files (in worst cases dozens of files) can improve performance by an order of magnitude

    throws Doctrine_Exception


  • $specifiedConnections Array of connections you wish to create the database for

    createDatabases($specifiedConnections = array())

    Creates databases for connections


  • $array An array of models to be exported

    createTablesFromArray($array)

    Creates database tables for the models in the supplied array


  • $directory Directory containing your models

    createTablesFromModels($directory = null)

    Creates database tables for the models in the specified directory


  • debug($bool = null)

    Turn on/off the debugging setting


  • $specifiedConnections Array of connections you wish to drop the database for

    dropDatabases($specifiedConnections = array())

    Drops databases for connections


  • $var a variable of any type
    $output whether to output the content
    $indent indention string

    dump($var, $output = true, $indent = "")

    dumps a given variable


  • $yamlPath Path to write the yaml data fixtures to
    $individualFiles Whether or not to dump data to individual fixtures files

    dumpData($yamlPath, $individualFiles = false)

    Dump data to a yaml fixtures file


  • $classes Array of classes to filter through, otherwise uses get_declared_classes()

    (array) filterInvalidModels((classes) $classes)

    Filter through an array of classes and return all the classes that are valid models.

    This will inflect the class, causing it to be loaded in to memory.


  • $className Name of the Migration class to generate
    $migrationsPath Path to directory which contains your migration classes

    generateMigrationClass($className, $migrationsPath)

    Generate new migration class skeleton


  • generateMigrationsFromDb($migrationsPath)

    Generate a set of migration classes from an existing database

    throws new Doctrine_Migration_Exception


  • $migrationsPath Path to your Doctrine migration classes
    $modelsPath Path to your Doctrine model classes
    $modelLoading Style of model loading to use for loading the models in order to generate migrations

    generateMigrationsFromModels($migrationsPath, $modelsPath = null, $modelLoading = null)

    Generate a set of migration classes from an existing set of models


  • $directory Directory to write your models to
    $databases Array of databases to generate models for
    $options Array of options

    (boolean) generateModelsFromDb($directory, $databases = array(), $options = array())

    Method for importing existing schema to Doctrine_Record classes

    throws Exception


  • $yamlPath Path to your yaml schema files
    $directory Directory to generate your models in
    $options Array of options to pass to the schema importer

    generateModelsFromYaml($yamlPath, $directory, $options = array())

    Generate a yaml schema file from an existing directory of models


  • (array) generateSqlFromArray($array)

    Generate a array of sql for the passed array of models


  • (string) generateSqlFromModels($directory = null)

    Generate a sql string to create the tables from all loaded models or the models found in the passed directory.

    Doctrine


  • $yamlPath Path to write oyur yaml schema file to
    $options Array of options

    generateYamlFromDb($yamlPath, $databases = array(), $options = array())

    Generates models from database to temporary location then uses those models to generate a yaml schema file.

    This should probably be fixed. We should write something to generate a yaml schema file directly from the database.


  • $yamlPath Path to your yaml schema files
    $directory Directory to generate your models in

    generateYamlFromModels($yamlPath, $directory)

    Generate yaml schema file for the models in the specified directory


  • getConnectionByTableName($tableName)

    Get the connection object for a table by the actual table name FIXME: I think this method is flawed because a individual connections could have the same table name


  • (array) getLoadedModelFiles()

    Returns an array of all the loaded models and the path where each of them exists


  • $classes Array of classes to filter through, otherwise uses get_declared_classes()

    (array) getLoadedModels((classes) $classes = null)

    Get all the loaded models, you can provide an array of classes or it will use get_declared_classes()

    Will filter through an array of classes and return the Doctrine_Records out of them. If you do not specify $classes it will return all of the currently loaded Doctrine_Records


  • (string) getPath()

    Get the root path to Doctrine


  • getTable($componentName)

    Get the Doctrine_Table object for the passed model


  • (array) initializeModels($models)

    Initialize all models so everything is present and loaded in to memory

    This will also inheritently initialize any model behaviors and add the models generated by Doctrine generators and add them to the $models array


  • $class Can be a string named after the class, an instance of the class, or an instance of the class reflected

    (boolean) isValidModelClass($class)

    Checks if what is passed is a valid Doctrine_Record Will load class in to memory in order to inflect it and find out information about the class


  • $yamlPath Path to your yaml data fixtures
    $append Whether or not to append the data

    loadData($yamlPath, $append = false)

    Load data from a yaml fixtures file.

    The output of dumpData can be fed to loadData


  • loadModel($className, $path = null)

    Load an individual model name and path in to the model loading registry


  • $directory Path to directory of models or array of directory paths
    $modelLoading Pass value of Doctrine::ATTR_MODEL_LOADING to force a certain style of model loading Allowed Doctrine::MODEL_LOADING_AGGRESSIVE(default) or Doctrine::MODEL_LOADING_CONSERVATIVE

    loadModels($directory, $modelLoading = null)

    Recursively load all models from a directory or array of directories


  • $migrationsPath Path to migrations directory which contains your migration classes
    $to Version you wish to migrate to.

    (bool) migrate($migrationsPath, $to = null)

    Migrate database to specified $to version. Migrates from current to latest if you do not specify.

    Doctrine

    throws new Doctrine_Migration_Exception


  • __construct()

    throws Doctrine_Exception