Skip to content

Commit d85a96c

Browse files
committed
Fixing manual install doc for TDBM 5.1
1 parent 686ab36 commit d85a96c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

doc/manual_install.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ Depending [on the framework you are using](install.md) (and the integration pack
1212

1313
Hopefully, if your framework is not supported yet (or if you use no framework), setting up TDBM yourself is quite easy to do.
1414

15+
## Installing TDBM
16+
17+
Simply run:
18+
19+
```php
20+
$ composer require thecodingmachine/tdbm ^5.1
21+
```
22+
23+
## Instantiating the TDBMService
24+
1525
At minimum, you need a [Doctrine database `Connection`](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html) and a [Doctrine cache object](http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/caching.html).
1626

1727
We strongly advise to use the `APCuCache` from Doctrine that will yield the best performances.
@@ -35,9 +45,6 @@ $dbConnection = Doctrine\DBAL\DriverManager::getConnection($connectionParams, $c
3545
$beanNamespace = 'MyApp\\Beans';
3646
$daoNamespace = 'MyApp\\Daos';
3747

38-
// The naming strategy used to define the classname of DAOs and beans.
39-
$namingStrategy = new TheCodingMachine\TDBM\Utils\DefaultNamingStrategy();
40-
4148
$cache = new Doctrine\Common\Cache\ApcuCache();
4249

4350
$logger = new Monolog\Logger(); // $logger must be a PSR-3 compliant logger (optional).
@@ -47,7 +54,7 @@ $configuration = new TheCodingMachine\TDBM\Configuration(
4754
$beanNamespace,
4855
$daoNamespace,
4956
$dbConnection,
50-
$namingStrategy,
57+
null, // An optional "naming strategy" if you want to change the way beans/DAOs are named
5158
$cache,
5259
null, // An optional SchemaAnalyzer instance
5360
$logger, // An optional logger
@@ -96,6 +103,13 @@ $user = $userDao->getById(42);
96103
echo $user->getLogin();
97104
```
98105

106+
## Integrating TDBM in your own framework
107+
108+
The code samples above are here to help you understand the way `TDBMService` is instantiated.
109+
110+
Of course, in a real application, you will want to put the `TDBMService` and every generated DAOs in a container.
111+
You will typically inject the DAOs in your code and will seldom use the `TDBMService` directly.
112+
99113
## Next step
100114

101115
Let's now learn how to [access the database](quickstart.md).

0 commit comments

Comments
 (0)