11Doctrine ORM Service Provider
22=============================
33
4- Provides Doctrine ORM Entity Managers as services to Silex applications.
4+ Provides Doctrine ORM Entity Managers as services to Pimple applications.
55
66
77Features
88--------
99
10- * Leverages the core [ Doctrine Service Provider] [ 1 ]
10+ * Leverages the core [ Doctrine Service Provider] [ 1 ] for either
11+ Silex or Cilex.
1112 * Default Entity Manager can be bound to any database connection
1213 * Multiple Entity Managers can be defined
1314 * Mechanism for allowing Service Providers to register their own
@@ -22,7 +23,8 @@ Requirements
2223
2324The [ Doctrine Service Provider] [ 1 ] (or something looking a whole lot
2425like it) ** must** be available in order for Doctrine ORM Service
25- Provider to function properly. Currently requires both ** dbs** and ** dbs.event_manager** services in order to work. If you can or want
26+ Provider to function properly. Currently requires both ** dbs** and
27+ ** dbs.event_manager** services in order to work. If you can or want
2628to fake it, go for it. :)
2729
2830
@@ -39,7 +41,7 @@ for **orm.generate_psr0_mapping** for more information.
3941Installation
4042------------
4143
42- Through [ Composer] ( http://getcomposer.org )
44+ Through [ Composer] ( http://getcomposer.org ) as [ dflydev/doctrine-orm-service-provider ] [ 7 ] .
4345
4446
4547Usage
@@ -49,6 +51,59 @@ To get up and running, register `DoctrineOrmServiceProvider` and
4951manually specify the directory that will contain the proxies along
5052with at least one mapping.
5153
54+ ### Pimple
55+
56+ ``` php
57+ <?php
58+
59+ use Dflydev\Pimple\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
60+
61+ $container = new \Pimple;
62+
63+ $container["db.options"] = array(
64+ "driver" => "pdo_sqlite",
65+ "path" => "/path/to/sqlite.db",
66+ );
67+
68+ // ensure that $container['dbs'] and $container['dbs.event_manager']
69+ // are available, most likely by way of a core service provider.
70+
71+ $container["orm.proxies_dir"] = "/path/to/proxies";
72+ $container["orm.em.options"] = array(
73+ "mappings" => array(
74+ // Using actual filesystem paths
75+ array(
76+ "type" => "annotation",
77+ "namespace" => "Foo\Entities",
78+ "path" => __DIR__."/src/Foo/Entities",
79+ ),
80+ array(
81+ "type" => "xml",
82+ "namespace" => "Bat\Entities",
83+ "path" => __DIR__."/src/Bat/Resources/mappings",
84+ ),
85+ // Using PSR-0 namespaceish embedded resources
86+ // (requires registering a PSR-0 Resource Locator
87+ // Service Provider)
88+ array(
89+ "type" => "annotations",
90+ "namespace" => "Baz\Entities",
91+ "resources_namespace" => "Baz\Entities",
92+ ),
93+ array(
94+ "type" => "xml",
95+ "namespace" => "Bar\Entities",
96+ "resources_namespace" => "Bar\Resources\mappings",
97+ ),
98+ ),
99+ );
100+
101+ $doctrineOrmServiceProvider = new DoctrineOrmServiceProvider;
102+ $doctrineormServiceProvider->register($container);
103+ ```
104+
105+ ### Silex
106+
52107``` php
53108<?php
54109
@@ -303,6 +358,7 @@ Some inspiration was also taken from [Doctrine Bundle][4] and
303358[ 4 ] : https://github.com/doctrine/DoctrineBundle
304359[ 5 ] : https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Doctrine
305360[ 6 ] : http://github.com/dflydev/dflydev-psr0-resource-locator-service-provider
361+ [ 7 ] : https://packagist.org/packages/dflydev/doctrine-orm-service-provider
306362
307363[ #dflydev ] : irc://irc.freenode.net/#dflydev
308364[ #silex-php ] : irc://irc.freenode.net/#silex-php
0 commit comments