library doctrine-orm-service-provider
Provides Doctrine ORM to Silex application
kzykhys/doctrine-orm-service-provider
Provides Doctrine ORM to Silex application
- Wednesday, May 29, 2013
- by kzykhys
- Repository
- 1 Watchers
- 1 Stars
- 10 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
DoctrineORMServiceProvider
The DoctrineORMServiceProvider provides integration with the Doctrine ORM, (*1)
Installation
``` json
{
"require": {
"kzykhys/doctrine-orm-service-provider":"dev-master"
}
}, (*2)
Parameters
----------
* **orm.cache.dir**: The cache directory to store the doctrine cache data.
* **orm.entity.path**: Array of directory.
* **orm.proxy.dir**: The directory to store proxy classes.
* **orm.proxy.namespace**: The namespace of each proxy classes.
Services
--------
* **orm.em**: Entity Manager for Doctrine, instance of `Doctrine\ORM\EntityManager`.
* **orm.schema_tool**: instance of `Doctrine\ORM\Tools\SchemaTool`.
Usage
-----
``` php
<?php
use Silex\Application;
use Silex\Provider\DoctrineServiceProvider;
use KzykHys\Silex\Provider\DoctrineORM\DoctrineORMServiceProvider;
$app = new Silex\Application();
$app->register(new DoctrineServiceProvider(), array(
'db.options' => '...'
));
$app->register(new DoctrineORMServiceProvider(), array(
'orm.cache.dir' => __DIR__ . '/app/cache/doctrine/orm',
'orm.entity.path' => array(__DIR__ . '/path/to/entity_dir'),
'orm.proxy.dir' => __DIR__ . '/app/cache/doctrine/proxies',
'orm.proxy.namespace' => 'Your\Namespace\Orm\Proxies'
));
$app->get('/new', function (Application $app) {
$user = new User();
$app['orm.em']->persist($user);
$app['orm.em']->flush();
});
dev-master
9999999-dev
Provides Doctrine ORM to Silex application
Sources
Download
MIT
The Requires
The Development Requires
by
Kazuyuki Hayashi