Sunteți pe pagina 1din 1

C h e at Sh e e t Command Line Interface Doctrine Query Language

h ttp: //w w w. ph pdoct rine .org


./doctrine $query = new Doctrine_Query();
Doctrine Command Line Interface $results = $query->delete()->update()->set()->select()->distinct()
Doctrine Facade ->forUpdate()->from()->leftJoin()->innerJoin()->where()->addWhere()
./doctrine build-all ->whereIn()->whereNotIn()->orderBy()->groupBy()->addGroupBy()
$path = Doctrine::getPath(); ./doctrine build-all-load ->having()->addHaving()->addOrderBy()->limit()->offset()
$models = Doctrine::loadModels($modelsPath); ./doctrine build-all-reload ->setHydrationMode();
$models = Doctrine::getLoadedModels(); ./doctrine compile
Doctrine::generateModelsFromDb($modelsPath); ./doctrine create-db $count = $query->count();
Doctrine::generateYamlFromDb($schemasPath); ./doctrine create-tables $results = $query->execute(array $params);
Doctrine::generateModelsFromYaml($schemasPath, $modelsPath); ./doctrine dql $firstRecord = $results->getFirst();
Doctrine::createTablesFromModels($modelsPath); ./doctrine drop-db $lastRecord = $results->getLast();
Doctrine::generateSqlFromModels($modelsPath); ./doctrine dump-data $count = $results->count();
Doctrine::generateYamlFromModels($schemasPath, $modelsPath); ./doctrine generate-migration
$results = Doctrine::createDatabases(); ./doctrine generate-migrations-db
$results = Doctrine::dropDatabases(); ./doctrine generate-migrations-models
Doctrine::dumpData($fixturesPath); ./doctrine generate-models-db
Doctrine::loadData($fixturesPath); ./doctrine generate-models-yaml Validators
Doctrine::migration($migrationsPath, $versionNum); ./doctrine generate-sql
Doctrine::generateMigrationClass($className, $migrationsPath); ./doctrine generate-yaml-db notnull, email, notblank, nospace, past, future, minlength(length), country,
Doctrine::generateMIgrationsFromDb($migrationsPath); ./doctrine generate-yaml-models ip, htmlcolor, range(min, max), unique, regexp(expression), creditcard,
Doctrine::generateMigrationsFromModels($migrationsPath, $modelsPath); ./doctrine load-data digits(int, frac)
$modelNameTable = Doctrine::getTable($modelName); ./doctrine load-dummy-data
Doctrine::compile(‘/path/to/doctrine/lib’, array $drivers); ./doctrine migrate
Doctrine_Manager::getInstance()->setAttribute($attribute, $value); ./doctrine rebuild-db
$conn = Doctrine_Manager::connection($dsn, $connName); Migrations
$conn = Doctrine_Manager::getInstance()->getConnection($connName);
$manager = Doctrine_Manager::getInstance();
Data Fixtures up() down() preUp() postUp() preDown() postDown()

createTable($tableName, array $fields, array $options);


User:
dropTable($tableName);
Records / Collections Schema Files username: jwage
renameTable($oldTableName, $newTableName);
password: changeme
createConstraint($tableName, $constraintName, array $definition);
User_1:
setTableDefinition() type: string(length) dropConstraint($tableName, $constraintName, $primary = false);
Phonenumbers: [Phone_1]
setUp() length: integer createForeignKey($tableName, array $definition);
User_2:
hasOne(‘Model’, $options); connection: conn_name dropForeignKey($tableName, $fkName);
Phonenumbers:
hasMany(‘Model’, $options); package: PackageName addColumn($tableName, $columnName, $type, array $options);
Phone_2:
$options = array(‘local’ => ‘local_id’, ‘foreign’ actAs: [BehaviorName] renameColumn($tableName, $oldColumnName, $newColumnName);
number: 555-555-5555
=> ‘id’, ‘refClass’ => ‘XrefModel’); validator_name: name changeColumn($tableName, $columnName, $type, array $options);
Profile: Profile_1
hasColumn($name, $type, $length $options); autoincrement: true removeColumn($tableName, $columnName);
index($name, $options); columns: addIndex($tableName, $indexName, array $options);
Profile:
actAs(‘BehaviorName’); username: string(255) removeIndex($tableName, $indexName);
Profile_1:
option($name, $value); relations:
first_name: Jonathan
$record->toArray($deep = true); Phonenumbers:
last_name: Wage
$collection->toArray($deep = true); class: Phonenumber
email_address: jonwage@gmail.com
$collection->getFirst(); local: user_id
Phonenumber:
Model Loading
$collection->getLast(); foreign: phonenumber_id
Phone_1:
$collection->count(); refClass: UserPhonenumber $manager->setAttribute(‘model_loading’, ‘conservative’); // lazy loading
User: User_1
$record->fromArray($array); foreignAlias: Users $manager->setAttribute(‘model_loading’, ‘aggressive’); // require_once all
number: 555-555-5555
$collection->fromArray($array); foreignType: many spl_autoload_register(array(‘Doctrine’, ‘autoload’));
type: many Doctrine::loadModels($models);

S-ar putea să vă placă și