Commit 64638645 authored by jwage's avatar jwage

[2.0] Removing upgrade file as it is not needed

parent 374733a9
## Installing
Currently the only way to install is via svn. So just checkout the trunk.
$ svn co http://svn.doctrine-project.org/trunk/lib doctrine
$ cd doctrine
## Loading Doctrine
First we need to require one class, the `ClassLoader`.
>**NOTE**
> This assumes you've created some kind of script to test the following code in. Something like a `test.php` file.
[php]
// test.php
require_once 'lib/Doctrine/Common/ClassLoader.php';
Now we need to instantiate the `ClassLoader` and register it:
[php]
$classLoader = new \Doctrine\Common\ClassLoader();
$classLoader->register();
The Doctrine `ClassLoader` supports the ability to use it for loading other classes with a prefix.
Here are the recommend usages for the Doctrine `ClassLoader`:
* Use only 1 class loader instance.
* Set the base paths to your class libraries (including Doctrine's) through
-
[php]
$classLoader->setBasePath($prefix, $basePath);
For example you can set the path for Doctrine with the following:
[php]
$classLoader->setBasePath('Doctrine', '/usr/local/phplibs/doctrine/lib');
Then, when trying to load the class Doctrine\ORM\EntityManager, for example the class loader will look for /usr/local/phplibs/doctrine/lib/Doctrine/ORM/EntityManager.php
* DO NOT setCheckFileExists(true). Doing so is expensive in terms of performance.
* Use an opcode-cache (i.e. APC) (STRONGLY RECOMMENDED).
## Initialize Doctrine
[php]
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\ORM\Cache\ArrayCache);
$eventManager = new \Doctrine\Common\EventManager();
$connectionOptions = array(
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite'
);
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, 'doctrine', $config, $eventManager);
## Getting the Connection
[php]
$conn = $em->getConnection();
$conn->delete('table_name', array(1, 3, 10));
The DBAL Connection class has lots of useful functions. You can browse the code and check the API to get familiar.
## The Schema Manager
The schema manager is a nice API for issuing database DDL statements like creating a table, or dropping a table.
[php]
$sm = $connection->getSchemaManager();
The schema manager allows you to do all the familiar options on your schema. Like `createTable()`. Below you will find an example:
[php]
$sm->createTable($tableName, $columns, $options);
## The Platform Object
The platform object is the object that provides the appropriate SQL to the schema manager for the DDL statements.
[php]
$platform = $connection->getDatabasePlatform();
Now we can get the generated SQL instead of executing it directly:
[php]
$sql = $platform->getCreateTableSql($tableName, $columns, $options);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment