kzykhys / doctrine-orm-service-provider
Provides Doctrine ORM to Silex application
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/kzykhys/doctrine-orm-service-provider
Requires
- doctrine/orm: >=2.2.0,<2.4.0-dev
 - silex/silex: 1.0.*@dev
 
Requires (Dev)
- kzykhys/console-service-provider: dev-master
 
Suggests
- kzykhys/console-service-provider: Allows doctrine commands on silex application
 
This package is not auto-updated.
Last update: 2025-11-03 20:21:02 UTC
README
The DoctrineORMServiceProvider provides integration with the Doctrine ORM
Installation
{
    "require": {
        "kzykhys/doctrine-orm-service-provider":"dev-master"
    }
}
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 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(); });