https://github.com/thecodingmachine/tdbm-universal-module
Cross-framework module for thecodingmachine/tdbm
https://github.com/thecodingmachine/tdbm-universal-module
Last synced: 3 months ago
JSON representation
Cross-framework module for thecodingmachine/tdbm
- Host: GitHub
- URL: https://github.com/thecodingmachine/tdbm-universal-module
- Owner: thecodingmachine
- Created: 2017-12-15T10:13:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-15T13:55:46.000Z (over 8 years ago)
- Last Synced: 2025-02-16T12:30:30.640Z (over 1 year ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/thecodingmachine/tdbm-universal-module)
[](https://packagist.org/packages/thecodingmachine/tdbm-universal-module)
[](https://packagist.org/packages/thecodingmachine/tdbm-universal-module)
[](https://travis-ci.org/thecodingmachine/tdbm-universal-module)
[](https://coveralls.io/github/thecodingmachine/tdbm-universal-module?branch=master)
# TDBM universal module
This package integrates TDBM in any [container-interop](https://github.com/container-interop/service-provider) compatible framework/container.
## Tutorial
Looking for a tutorial to get started? Check out the [TDBM 5 + container-interop/service-providers install guide](https://thecodingmachine.github.io/tdbm/doc/install_service-provider.html).
## Installation
```
composer require thecodingmachine/tdbm-universal-module
```
Once installed, you need to register the [`TheCodingMachine\TDBM\DI\TdbmServiceProvider`](src/DI/TdbmServiceProvider.php) into your container.
If your container supports [thecodingmachine/discovery](https://github.com/thecodingmachine/discovery) integration, you have nothing to do. Otherwise, refer to your framework or container's documentation to learn how to register *service providers*.
## Introduction
This service provider is meant to integrate TDBM in your application.
It will register the "tdbm:generate" command in the console (`vendor/bin/app_console`) and register all generated DAOs in the container.
## Expected values / services
This *service provider* expects the following configuration / services to be available:
| Name | Compulsory | Description |
|-----------------------------------------|------------|----------------------------------------|
| `tdbm.daoNamespace` | *no* | The namespace of the DAOs. If not specified, it will be guessed from your composer.json autoload section. |
| `tdbm.beanNamespace` | *no* | The namespace of the beans. If not specified, it will be guessed from your composer.json autoload section. |
| `Doctrine\DBAL\Connection` | *yes* | The database connection. |
| `Doctrine\Common\Cache\Cache` | *yes* | The cache service. |
| `Symfony\Component\Console\Application` | *yes* | The console application. |
## Provided services
This *service provider* provides the following services:
**One service is created for each of your DAOs. The name of the service is the fully qualified name of your DAOs.**
If you have a `App\Dao\UserDao` class generated by TDBM, then that class is also available in the container using `$container->get("App\Dao\UserDao")`.
| Service name | Description |
|-----------------------------|--------------------------------------|
| `TheCodingMachine\TDBM\TDBMService` | The TDBMService |
| `TheCodingMachine\TDBM\Configuration` | The TDBM configuration |
| `TheCodingMachine\TDBM\Utils\NamingStrategyInterface` | The naming strategy for the beans |
| `TheCodingMachine\TDBM\Services\DaoDumper` | Utility class used to optimize the service provider |
| `TheCodingMachine\TDBM\Utils\GeneratorListenerInterface[]` | An array of generator listeners (contains the DaoDumper and can be extended by other providers to add more). |
## Extended services
This *service provider* extends those services:
| Name | Compulsory | Description |
|-----------------------------------------|------------|-----------------------------------|
| `Symfony\Component\Console\Application` | *yes* | A command is added to the service |
Project template courtesy of thecodingmachine/service-provider-template