@@ -12,11 +12,6 @@ and a ``Doctrine\DBAL\Result`` wraps a ``Doctrine\DBAL\Driver\Result``.
1212and ``Doctrine\DBAL\Driver\Result `` are just interfaces.
1313These interfaces are implemented by concrete drivers.
1414
15- What do the wrapper components add to the underlying driver
16- implementations? The enhancements include SQL logging, events and
17- control over the transaction isolation level in a portable manner,
18- among others.
19- 
2015Apart from the three main components, a DBAL driver should also provide
2116an implementation of the ``Doctrine\DBAL\Driver `` interface that
2217has two primary purposes:
@@ -26,18 +21,40 @@ has two primary purposes:
26212. Act as a factory of other driver-specific components like
2722 platform, schema manager and exception converter.
2823
24+ The driver components can be decorated using the four driver interfaces in
25+ order to add driver-independent functionality like logging or profiling. Those
26+ decorators are configured as a middleware.
27+ 
28+ The wrapper components ``Connection ``, ``Statement `` and ``Result `` are the
29+ objects that the application usually interacts with directly. They wrap the
30+ middleware stack as well as the driver at the bottom of that stack.
31+ 
2932The DBAL is separated into several different packages that
3033separate responsibilities of the different RDBMS layers.
3134
3235Drivers
3336------- 
3437
35- The drivers abstract a PHP specific database API by enforcing three 
38+ The drivers abstract a PHP specific database API by enforcing four 
3639interfaces:
3740
38- - ``\Doctrine\DBAL\Driver\Connection ``
39- - ``\Doctrine\DBAL\Driver\Statement ``
40- - ``\Doctrine\DBAL\Driver\Result ``
41+ - ``Doctrine\DBAL\Driver ``
42+ - ``Doctrine\DBAL\Driver\Connection ``
43+ - ``Doctrine\DBAL\Driver\Statement ``
44+ - ``Doctrine\DBAL\Driver\Result ``
45+ 
46+ Middlewares
47+ ----------- 
48+ 
49+ A middleware sits in the middle between the wrapper components and the driver.
50+ By implementing the ``Doctrine\DBAL\Driver\Middleware ``, it decorates the
51+ ``Driver `` component of either the actual driver or a lower middleware. If
52+ necessary, the middleware might also decorate ``Connection ``, ``Statement ``
53+ and ``Result ``.
54+ 
55+ An example for a middleware implementation is
56+ ``Doctrine\DBAL\Logging\Middleware `` which implements logging capabilities
57+ on top of a driver.
4158
4259Platforms
4360--------- 
@@ -72,4 +89,3 @@ The types offer an abstraction layer for the converting and
7289generation of types between Databases and PHP. Doctrine comes
7390bundled with some common types but offers the ability for
7491developers to define custom types or extend existing ones easily.
75- 
0 commit comments