{"id":21819356,"url":"https://github.com/dflydev/dflydev-doctrine-orm-service-provider","last_synced_at":"2025-05-16T12:06:52.436Z","repository":{"id":5059043,"uuid":"6220629","full_name":"dflydev/dflydev-doctrine-orm-service-provider","owner":"dflydev","description":"Doctrine ORM Service Provider","archived":false,"fork":false,"pushed_at":"2023-01-30T16:26:08.000Z","size":113,"stargazers_count":209,"open_issues_count":22,"forks_count":58,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T07:04:33.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dkhamsing/ScrollTab","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dflydev.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-15T02:20:48.000Z","updated_at":"2024-07-05T13:01:06.000Z","dependencies_parsed_at":"2023-02-16T09:16:15.969Z","dependency_job_id":null,"html_url":"https://github.com/dflydev/dflydev-doctrine-orm-service-provider","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-doctrine-orm-service-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-doctrine-orm-service-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-doctrine-orm-service-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-doctrine-orm-service-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflydev","download_url":"https://codeload.github.com/dflydev/dflydev-doctrine-orm-service-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527085,"owners_count":22085918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T16:18:37.385Z","updated_at":"2025-05-16T12:06:52.370Z","avatar_url":"https://github.com/dflydev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Doctrine ORM Service Provider\n=============================\n\nProvides Doctrine ORM Entity Managers as services to Pimple applications.\n\n\nFeatures\n--------\n\n * Leverages the core [Doctrine Service Provider][1] for either\n   Silex.\n * Default Entity Manager can be bound to any database connection\n * Multiple Entity Managers can be defined\n * Mechanism for allowing Service Providers to register their own\n   mappings\n\n\nRequirements\n------------\n\n * PHP 5.3+\n * Pimple ~2.1\n * Doctrine ~2.3\n\nCurrently requires both **dbs** and **dbs.event_manager** services in\norder to work. These can be provided by a Doctrine Service Provider\nlike the [Silex][1] one. If you can or want to fake it, go for it. :)\n\n \nInstallation\n------------\n \nThrough [Composer](http://getcomposer.org) as [dflydev/doctrine-orm-service-provider][6].\n\n\nUsage\n-----\n\nTo get up and running, register `DoctrineOrmServiceProvider` and\nmanually specify the directory that will contain the proxies along\nwith at least one mapping.\n\nIn each of these examples an Entity Manager that is bound to the\ndefault database connection will be provided. It will be accessible\nvia **orm.em**.\n\n```php\n\u003c?php\n\n// Default entity manager.\n$em = $app['orm.em'];\n```\n\n### Pimple\n\n```php\n\u003c?php\n\nuse Dflydev\\Provider\\DoctrineOrm\\DoctrineOrmServiceProvider;\nuse Pimple\\Container;\n\n$container = new Container;\n\n$container['db.options'] = array(\n    'driver' =\u003e 'pdo_sqlite',\n    'path' =\u003e '/path/to/sqlite.db',\n);\n\n// ensure that $container['dbs'] and $container['dbs.event_manager']\n// are available, most likely by way of a core service provider.\n\n$container-\u003eregister(new DoctrineOrmServiceProvider, array(\n    'orm.proxies_dir' =\u003e '/path/to/proxies',\n    'orm.em.options' =\u003e array(\n        'mappings' =\u003e array(\n            // Using actual filesystem paths\n            array(\n                'type' =\u003e 'annotation',\n                'namespace' =\u003e 'Foo\\Entities',\n                'path' =\u003e __DIR__.'/src/Foo/Entities',\n            ),\n            array(\n                'type' =\u003e 'xml',\n                'namespace' =\u003e 'Bat\\Entities',\n                'path' =\u003e __DIR__.'/src/Bat/Resources/mappings',\n            ),\n            // XML/YAML driver (Symfony2 style)\n            // Mapping files can be named like Foo.orm.yml\n            // instead of Baz.Entities.Foo.dcm.yml\n            array(\n                'type' =\u003e 'simple_yml',\n                'namespace' =\u003e 'Baz\\Entities',\n                'path' =\u003e __DIR__.'/src/Bat/Resources/config/doctrine',\n            ),\n        ),\n    ),\n));\n```\n\n### Silex\n\nVersion 2.x of this service provider is compatible with version 2.x of Silex and version 1.x of this service provider is compatible with version 1.x of Silex. The following is an example of version 2.x of this service provider and version 2.x of Silex.\n\n```php\n\u003c?php\n\nuse Dflydev\\Provider\\DoctrineOrm\\DoctrineOrmServiceProvider;\nuse Silex\\Application;\nuse Silex\\Provider\\DoctrineServiceProvider;\n\n$app = new Application;\n\n$app-\u003eregister(new DoctrineServiceProvider, array(\n    'db.options' =\u003e array(\n        'driver' =\u003e 'pdo_sqlite',\n        'path' =\u003e '/path/to/sqlite.db',\n    ),\n));\n\n$app-\u003eregister(new DoctrineOrmServiceProvider, array(\n    'orm.proxies_dir' =\u003e '/path/to/proxies',\n    'orm.em.options' =\u003e array(\n        'mappings' =\u003e array(\n            // Using actual filesystem paths\n            array(\n                'type' =\u003e 'annotation',\n                'namespace' =\u003e 'Foo\\Entities',\n                'path' =\u003e __DIR__.'/src/Foo/Entities',\n            ),\n            array(\n                'type' =\u003e 'xml',\n                'namespace' =\u003e 'Bat\\Entities',\n                'path' =\u003e __DIR__.'/src/Bat/Resources/mappings',\n            ),\n        ),\n    ),\n));\n```\n\nConfiguration\n-------------\n\n### Parameters\n\n * **orm.em.options**:\n   Array of Entity Manager options.\n\n   These options are available:\n   * **connection** (Default: default):\n     String defining which database connection to use. Used when using\n     named databases via **dbs**.\n   * **mappings**:\n     Array of mapping definitions.\n\n     Each mapping definition should be an array with the following\n     options:\n     * **type**: Mapping driver type, one of `annotation`, `xml`, `yml`, `simple_xml`, `simple_yml` or `php`.\n     * **namespace**: Namespace in which the entities reside.\n     \n     *New: the `simple_xml` and `simple_yml` driver types were added in v1.1 and provide support for the [simplified XML driver][8] and [simplified YAML driver][9] of Doctrine.*\n\n     Additionally, each mapping definition should contain one of the\n     following options:\n     * **path**: Path to where the mapping files are located. This should\n       be an actual filesystem path. For the php driver it can be an array\n       of paths\n     * **resources_namespace**: A namespaceish path to where the mapping\n       files are located. Example: `Path\\To\\Foo\\Resources\\mappings`\n\n     Each mapping definition can have the following optional options:\n     * **alias** (Default: null): Set the alias for the entity namespace.\n\n     Each **annotation** mapping may also specify the following options:\n     * **use_simple_annotation_reader** (Default: true):\n       If `true`, only simple notations like `@Entity` will work.\n       If `false`, more advanced notations and aliasing via `use` will\n       work. (Example: `use Doctrine\\ORM\\Mapping AS ORM`, `@ORM\\Entity`)\n       Note that if set to `false`, the `AnnotationRegistry` will probably\n       need to be configured correctly so that it can load your Annotations\n       classes. See this FAQ:\n       [Why aren't my Annotations classes being found?](#why-arent-my-annotations-classes-being-found)\n   * **query_cache** (Default: setting specified by orm.default_cache):\n     String or array describing query cache implementation.\n   * **metadata_cache** (Default: setting specified by orm.default_cache):\n     String or array describing metadata cache implementation.\n   * **result_cache** (Default: setting specified by orm.default_cache):\n     String or array describing result cache implementation.\n   * **hydration_cache** (Default: setting specified by orm.default_cache):\n     String or array describing hydration cache implementation.\n   * **types**\n     An array of custom types in the format of 'typeName' =\u003e 'Namespace\\To\\Type\\Class'\n * **orm.ems.options**:\n   Array of Entity Manager configuration sets indexed by each Entity Manager's\n   name. Each value should look like **orm.em.options**.\n   \n   Example configuration:\n\n   ```php\n   \u003c?php\n   $app['orm.ems.default'] = 'sqlite';\n   $app['orm.ems.options'] = array(\n       'mysql' =\u003e array(\n           'connection' =\u003e 'mysql',\n           'mappings' =\u003e array(), \n       ),\n       'sqlite' =\u003e array(\n           'connection' =\u003e 'sqlite',\n           'mappings' =\u003e array(),\n       ),\n   );\n   ```\n\n   Example usage:\n\n   ```php\n   \u003c?php\n   $emMysql = $app['orm.ems']['mysql'];\n   $emSqlite = $app['orm.ems']['sqlite'];\n   ```\n * **orm.ems.default** (Default: first Entity Manager processed):\n   String defining the name of the default Entity Manager.\n * **orm.proxies_dir**:\n   String defining path to where Doctrine generated proxies should be located.\n * **orm.proxies_namespace** (Default: DoctrineProxy):\n   String defining namespace in which Doctrine generated proxies should reside.\n * **orm.auto_generate_proxies**:\n   Boolean defining whether or not proxies should be generated automatically.\n * **orm.class_metadata_factory_name**: Class name of class metadata factory.\n   Class implements `Doctrine\\Common\\Persistence\\Mapping\\ClassMetadataFactory`.\n * **orm.default_repository_class**: Class name of default repository.\n   Class implements `Doctrine\\Common\\Persistence\\ObjectRepository`.\n * **orm.repository_factory**: Repository factory, instance `Doctrine\\ORM\\Repository\\RepositoryFactory`.\n * **orm.entity_listener_resolver**: Entity listener resolver, instance\n   `Doctrine\\ORM\\Mapping\\EntityListenerResolver`.\n * **orm.default_cache**:\n   String or array describing default cache implementation.\n * **orm.add_mapping_driver**:\n   Function providing the ability to add a mapping driver to an Entity Manager.\n\n   These params are available:\n    * **$mappingDriver**:\n      Mapping driver to be added,\n      instance `Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver`.\n    * **$namespace**:\n      Namespace to be mapped by `$mappingDriver`, string.\n    * **$name**:\n      Name of Entity Manager to add mapping to, string, default `null`.\n * **orm.em_name_from_param**:\n   Function providing the ability to retrieve an entity manager's name from\n   a param.\n\n   This is useful for being able to optionally allow users to specify which\n   entity manager should be configured for a 3rd party service provider\n   but fallback to the default entity manager if not explitely specified.\n\n   For example:\n\n   ```php\n   \u003c?php\n   $emName = $app['orm.em_name_from_param']('3rdparty.provider.em');\n   $em = $app['orm.ems'][$emName];\n   ```\n\n   This code should be able to be used inside of a 3rd party service provider\n   safely, whether the user has defined `3rdparty.provider.em` or not.\n * **orm.strategy**:\n   * **naming**: Naming strategy, instance `Doctrine\\ORM\\Mapping\\NamingStrategy`.\n   * **quote**: Quote strategy, instance `Doctrine\\ORM\\Mapping\\QuoteStrategy`.\n * **orm.custom.functions**:\n   * **string**, **numeric**, **datetime**: Custom DQL functions, array of class names indexed by DQL function name.\n     Classes are subclasses of `Doctrine\\ORM\\Query\\AST\\Functions\\FunctionNode`.\n   * **hydration_modes**: Hydrator class names, indexed by hydration mode name.\n     Classes are subclasses of `Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator`.\n  \n\n### Services\n\n * **orm.em**:\n   Entity Manager, instance `Doctrine\\ORM\\EntityManager`.\n * **orm.ems**:\n   Entity Managers, array of `Doctrine\\ORM\\EntityManager` indexed by name.\n\n\nFrequently Asked Questions\n--------------------------\n\n### Why aren't my Annotations classes being found?\n\nWhen **use_simple_annotation_reader** is set to `False` for an entity,\nthe `AnnotationRegistry` needs to have the project's autoloader added\nto it.\n\nExample:\n\n```php\n\u003c?php\n$loader = require __DIR__ . '/../vendor/autoload.php';\n\n\\Doctrine\\Common\\Annotations\\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));\n```\n\n### Why is there no manager registry implementation?\n\nThere is already a thirdparty `ManagerRegistry` implementation at [saxulum-doctrine-orm-manager-registry-provider][7].\nIt support the `entity` type known of the form component, adds the `UniqueEntity` validator and a command line integration.\n\n\nLicense\n-------\n\nMIT, see LICENSE.\n\n\nCommunity\n---------\n\nIf you have questions or want to help out, join us in the\n[#dflydev][dflydev] or [#silex-php][silex-php] channels on\nirc.freenode.net.\n\n\nNot Invented Here\n-----------------\n\nThis project is based heavily on both the core\n[Doctrine Service Provider][1] and the work done by [@docteurklein][2]\non the [docteurklein/silex-doctrine-service-providers][3] project.\nSome inspiration was also taken from [Doctrine Bundle][4] and\n[Doctrine Bridge][5].\n\n\n[1]: http://silex.sensiolabs.org/doc/providers/doctrine.html\n[2]: https://github.com/docteurklein\n[3]: https://github.com/docteurklein/SilexServiceProviders\n[4]: https://github.com/doctrine/DoctrineBundle\n[5]: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Doctrine\n[6]: https://packagist.org/packages/dflydev/doctrine-orm-service-provider\n[7]: https://github.com/saxulum/saxulum-doctrine-orm-manager-registry-provider\n[8]: http://docs.doctrine-project.org/en/latest/reference/xml-mapping.html#simplified-xml-driver\n[9]: http://docs.doctrine-project.org/en/latest/reference/yaml-mapping.html#simplified-yaml-driver\n\n[dflydev]: irc://irc.freenode.net/#dflydev\n[silex-php]: irc://irc.freenode.net/#silex-php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-doctrine-orm-service-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflydev%2Fdflydev-doctrine-orm-service-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-doctrine-orm-service-provider/lists"}