mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
Added DependencyInjection UML
This commit is contained in:
@@ -14,3 +14,7 @@ Notice we are following Inversion of control principle in `Connection` by asking
|
||||
|
||||
* The Doctrine2 ORM uses dependency injection e.g. for configuration that is injected into a `Connection` object. For testing purposes, one can easily create a mock object of the configuration and inject that into the `Connection` object
|
||||
* Symfony and Zend Framework 2 already have containers for DI that create objects via a configuration array and inject them where needed (i.e. in Controllers)
|
||||
|
||||
## UML Diagram
|
||||
|
||||

|
BIN
Structural/DependencyInjection/uml/uml.png
Normal file
BIN
Structural/DependencyInjection/uml/uml.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
1
Structural/DependencyInjection/uml/uml.svg
Normal file
1
Structural/DependencyInjection/uml/uml.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 7.9 KiB |
28
Structural/DependencyInjection/uml/uml.txt
Normal file
28
Structural/DependencyInjection/uml/uml.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
@startuml
|
||||
abstract class AbstractConfig {
|
||||
#$storage
|
||||
+__construct($storage)
|
||||
}
|
||||
|
||||
class ArrayConfig {
|
||||
+get($key : string|int, $default = null)
|
||||
+set($key : string|int, $value : mixed)
|
||||
}
|
||||
|
||||
class Connection {
|
||||
#$configuration : Parameters
|
||||
#$host
|
||||
+__construct(Parameters $config)
|
||||
+connect()
|
||||
+getHost()
|
||||
}
|
||||
|
||||
interface Parameters {
|
||||
+get($key : string|int)
|
||||
+set($key, $value : mixed)
|
||||
}
|
||||
|
||||
AbstractConfig <|.. ArrayConfig
|
||||
Parameters <|.. ArrayConfig
|
||||
|
||||
@enduml
|
Reference in New Issue
Block a user