@@ -17,21 +17,21 @@ |
||
17 | 17 | */ |
18 | 18 | class MoufConfiguration extends Configuration |
19 | 19 | { |
20 | - private $daoFactoryInstanceName = 'daoFactory'; |
|
20 | + private $daoFactoryInstanceName = 'daoFactory'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function getDaoFactoryInstanceName() : string |
|
26 | - { |
|
27 | - return $this->daoFactoryInstanceName; |
|
28 | - } |
|
22 | + /** |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function getDaoFactoryInstanceName() : string |
|
26 | + { |
|
27 | + return $this->daoFactoryInstanceName; |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * @param string $daoFactoryInstanceName |
|
32 | - */ |
|
33 | - public function setDaoFactoryInstanceName(string $daoFactoryInstanceName) |
|
34 | - { |
|
35 | - $this->daoFactoryInstanceName = $daoFactoryInstanceName; |
|
36 | - } |
|
30 | + /** |
|
31 | + * @param string $daoFactoryInstanceName |
|
32 | + */ |
|
33 | + public function setDaoFactoryInstanceName(string $daoFactoryInstanceName) |
|
34 | + { |
|
35 | + $this->daoFactoryInstanceName = $daoFactoryInstanceName; |
|
36 | + } |
|
37 | 37 | } |
@@ -33,42 +33,42 @@ |
||
33 | 33 | */ |
34 | 34 | class TDBMObject extends AbstractTDBMObject |
35 | 35 | { |
36 | - public function getProperty($var, $tableName = null) |
|
37 | - { |
|
38 | - return $this->get($var, $tableName); |
|
39 | - } |
|
36 | + public function getProperty($var, $tableName = null) |
|
37 | + { |
|
38 | + return $this->get($var, $tableName); |
|
39 | + } |
|
40 | 40 | |
41 | - public function setProperty($var, $value, $tableName = null) |
|
42 | - { |
|
43 | - $this->set($var, $value, $tableName); |
|
44 | - } |
|
41 | + public function setProperty($var, $value, $tableName = null) |
|
42 | + { |
|
43 | + $this->set($var, $value, $tableName); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Specify data which should be serialized to JSON. |
|
48 | - * |
|
49 | - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
|
50 | - * |
|
51 | - * @return mixed data which can be serialized by <b>json_encode</b>, |
|
52 | - * which is a value of any type other than a resource |
|
53 | - * |
|
54 | - * @since 5.4.0 |
|
55 | - */ |
|
56 | - public function jsonSerialize() |
|
57 | - { |
|
58 | - throw new TDBMException('Json serialization is only implemented for generated beans.'); |
|
59 | - } |
|
46 | + /** |
|
47 | + * Specify data which should be serialized to JSON. |
|
48 | + * |
|
49 | + * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
|
50 | + * |
|
51 | + * @return mixed data which can be serialized by <b>json_encode</b>, |
|
52 | + * which is a value of any type other than a resource |
|
53 | + * |
|
54 | + * @since 5.4.0 |
|
55 | + */ |
|
56 | + public function jsonSerialize() |
|
57 | + { |
|
58 | + throw new TDBMException('Json serialization is only implemented for generated beans.'); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Returns an array of used tables by this bean (from parent to child relationship). |
|
63 | - * |
|
64 | - * @return string[] |
|
65 | - */ |
|
66 | - protected function getUsedTables() : array |
|
67 | - { |
|
68 | - $tableNames = array_keys($this->dbRows); |
|
69 | - $tableNames = $this->tdbmService->_getLinkBetweenInheritedTables($tableNames); |
|
70 | - $tableNames = array_reverse($tableNames); |
|
61 | + /** |
|
62 | + * Returns an array of used tables by this bean (from parent to child relationship). |
|
63 | + * |
|
64 | + * @return string[] |
|
65 | + */ |
|
66 | + protected function getUsedTables() : array |
|
67 | + { |
|
68 | + $tableNames = array_keys($this->dbRows); |
|
69 | + $tableNames = $this->tdbmService->_getLinkBetweenInheritedTables($tableNames); |
|
70 | + $tableNames = array_reverse($tableNames); |
|
71 | 71 | |
72 | - return $tableNames; |
|
73 | - } |
|
72 | + return $tableNames; |
|
73 | + } |
|
74 | 74 | } |
@@ -15,161 +15,161 @@ |
||
15 | 15 | class Configuration implements ConfigurationInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - private $beanNamespace; |
|
22 | - /** |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - private $daoNamespace; |
|
26 | - /** |
|
27 | - * @var Connection |
|
28 | - */ |
|
29 | - private $connection; |
|
30 | - /** |
|
31 | - * @var Cache |
|
32 | - */ |
|
33 | - private $cache; |
|
34 | - /** |
|
35 | - * @var SchemaAnalyzer |
|
36 | - */ |
|
37 | - private $schemaAnalyzer; |
|
38 | - /** |
|
39 | - * @var LoggerInterface |
|
40 | - */ |
|
41 | - private $logger; |
|
42 | - /** |
|
43 | - * @var GeneratorListenerInterface |
|
44 | - */ |
|
45 | - private $generatorEventDispatcher; |
|
46 | - /** |
|
47 | - * @var NamingStrategyInterface |
|
48 | - */ |
|
49 | - private $namingStrategy; |
|
50 | - /** |
|
51 | - * @var string|null |
|
52 | - */ |
|
53 | - private $customComposerFile; |
|
54 | - |
|
55 | - /** |
|
56 | - * @param string $beanNamespace The namespace hosting the beans |
|
57 | - * @param string $daoNamespace The namespace hosting the DAOs |
|
58 | - * @param Connection $connection The connection to the database |
|
59 | - * @param Cache|null $cache The Doctrine cache to store database metadata |
|
60 | - * @param SchemaAnalyzer|null $schemaAnalyzer The schema analyzer that will be used to find shortest paths... Will be automatically created if not passed |
|
61 | - * @param LoggerInterface|null $logger The logger |
|
62 | - * @param GeneratorListenerInterface[] $generatorListeners A list of listeners that will be triggered when beans/daos are generated |
|
63 | - */ |
|
64 | - public function __construct(string $beanNamespace, string $daoNamespace, Connection $connection, NamingStrategyInterface $namingStrategy, Cache $cache = null, SchemaAnalyzer $schemaAnalyzer = null, LoggerInterface $logger = null, array $generatorListeners = []) |
|
65 | - { |
|
66 | - $this->beanNamespace = rtrim($beanNamespace, '\\'); |
|
67 | - $this->daoNamespace = rtrim($daoNamespace, '\\'); |
|
68 | - $this->connection = $connection; |
|
69 | - $this->namingStrategy = $namingStrategy; |
|
70 | - if ($cache !== null) { |
|
71 | - $this->cache = $cache; |
|
72 | - } else { |
|
73 | - $this->cache = new VoidCache(); |
|
74 | - } |
|
75 | - if ($schemaAnalyzer !== null) { |
|
76 | - $this->schemaAnalyzer = $schemaAnalyzer; |
|
77 | - } else { |
|
78 | - $this->schemaAnalyzer = new SchemaAnalyzer($this->connection->getSchemaManager(), $this->cache, $this->getConnectionUniqueId()); |
|
79 | - } |
|
80 | - $this->logger = $logger; |
|
81 | - $this->generatorEventDispatcher = new GeneratorEventDispatcher($generatorListeners); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getBeanNamespace(): string |
|
88 | - { |
|
89 | - return $this->beanNamespace; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function getDaoNamespace(): string |
|
96 | - { |
|
97 | - return $this->daoNamespace; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @return Connection |
|
102 | - */ |
|
103 | - public function getConnection(): Connection |
|
104 | - { |
|
105 | - return $this->connection; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * @return NamingStrategyInterface |
|
110 | - */ |
|
111 | - public function getNamingStrategy(): NamingStrategyInterface |
|
112 | - { |
|
113 | - return $this->namingStrategy; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @return Cache |
|
118 | - */ |
|
119 | - public function getCache(): Cache |
|
120 | - { |
|
121 | - return $this->cache; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @return SchemaAnalyzer |
|
126 | - */ |
|
127 | - public function getSchemaAnalyzer(): SchemaAnalyzer |
|
128 | - { |
|
129 | - return $this->schemaAnalyzer; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @return LoggerInterface |
|
134 | - */ |
|
135 | - public function getLogger(): ?LoggerInterface |
|
136 | - { |
|
137 | - return $this->logger; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * @return GeneratorListenerInterface |
|
142 | - */ |
|
143 | - public function getGeneratorEventDispatcher(): GeneratorListenerInterface |
|
144 | - { |
|
145 | - return $this->generatorEventDispatcher; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * Creates a unique cache key for the current connection. |
|
152 | - * |
|
153 | - * @return string |
|
154 | - */ |
|
155 | - private function getConnectionUniqueId(): string |
|
156 | - { |
|
157 | - return hash('md4', $this->connection->getHost().'-'.$this->connection->getPort().'-'.$this->connection->getDatabase().'-'.$this->connection->getDriver()->getName()); |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * @return null|string |
|
162 | - */ |
|
163 | - public function getCustomComposerFile() : ?string |
|
164 | - { |
|
165 | - return $this->customComposerFile; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * @param null|string $customComposerFile |
|
170 | - */ |
|
171 | - public function setCustomComposerFile($customComposerFile) |
|
172 | - { |
|
173 | - $this->customComposerFile = $customComposerFile; |
|
174 | - } |
|
18 | + /** |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + private $beanNamespace; |
|
22 | + /** |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + private $daoNamespace; |
|
26 | + /** |
|
27 | + * @var Connection |
|
28 | + */ |
|
29 | + private $connection; |
|
30 | + /** |
|
31 | + * @var Cache |
|
32 | + */ |
|
33 | + private $cache; |
|
34 | + /** |
|
35 | + * @var SchemaAnalyzer |
|
36 | + */ |
|
37 | + private $schemaAnalyzer; |
|
38 | + /** |
|
39 | + * @var LoggerInterface |
|
40 | + */ |
|
41 | + private $logger; |
|
42 | + /** |
|
43 | + * @var GeneratorListenerInterface |
|
44 | + */ |
|
45 | + private $generatorEventDispatcher; |
|
46 | + /** |
|
47 | + * @var NamingStrategyInterface |
|
48 | + */ |
|
49 | + private $namingStrategy; |
|
50 | + /** |
|
51 | + * @var string|null |
|
52 | + */ |
|
53 | + private $customComposerFile; |
|
54 | + |
|
55 | + /** |
|
56 | + * @param string $beanNamespace The namespace hosting the beans |
|
57 | + * @param string $daoNamespace The namespace hosting the DAOs |
|
58 | + * @param Connection $connection The connection to the database |
|
59 | + * @param Cache|null $cache The Doctrine cache to store database metadata |
|
60 | + * @param SchemaAnalyzer|null $schemaAnalyzer The schema analyzer that will be used to find shortest paths... Will be automatically created if not passed |
|
61 | + * @param LoggerInterface|null $logger The logger |
|
62 | + * @param GeneratorListenerInterface[] $generatorListeners A list of listeners that will be triggered when beans/daos are generated |
|
63 | + */ |
|
64 | + public function __construct(string $beanNamespace, string $daoNamespace, Connection $connection, NamingStrategyInterface $namingStrategy, Cache $cache = null, SchemaAnalyzer $schemaAnalyzer = null, LoggerInterface $logger = null, array $generatorListeners = []) |
|
65 | + { |
|
66 | + $this->beanNamespace = rtrim($beanNamespace, '\\'); |
|
67 | + $this->daoNamespace = rtrim($daoNamespace, '\\'); |
|
68 | + $this->connection = $connection; |
|
69 | + $this->namingStrategy = $namingStrategy; |
|
70 | + if ($cache !== null) { |
|
71 | + $this->cache = $cache; |
|
72 | + } else { |
|
73 | + $this->cache = new VoidCache(); |
|
74 | + } |
|
75 | + if ($schemaAnalyzer !== null) { |
|
76 | + $this->schemaAnalyzer = $schemaAnalyzer; |
|
77 | + } else { |
|
78 | + $this->schemaAnalyzer = new SchemaAnalyzer($this->connection->getSchemaManager(), $this->cache, $this->getConnectionUniqueId()); |
|
79 | + } |
|
80 | + $this->logger = $logger; |
|
81 | + $this->generatorEventDispatcher = new GeneratorEventDispatcher($generatorListeners); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getBeanNamespace(): string |
|
88 | + { |
|
89 | + return $this->beanNamespace; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function getDaoNamespace(): string |
|
96 | + { |
|
97 | + return $this->daoNamespace; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @return Connection |
|
102 | + */ |
|
103 | + public function getConnection(): Connection |
|
104 | + { |
|
105 | + return $this->connection; |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * @return NamingStrategyInterface |
|
110 | + */ |
|
111 | + public function getNamingStrategy(): NamingStrategyInterface |
|
112 | + { |
|
113 | + return $this->namingStrategy; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @return Cache |
|
118 | + */ |
|
119 | + public function getCache(): Cache |
|
120 | + { |
|
121 | + return $this->cache; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @return SchemaAnalyzer |
|
126 | + */ |
|
127 | + public function getSchemaAnalyzer(): SchemaAnalyzer |
|
128 | + { |
|
129 | + return $this->schemaAnalyzer; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @return LoggerInterface |
|
134 | + */ |
|
135 | + public function getLogger(): ?LoggerInterface |
|
136 | + { |
|
137 | + return $this->logger; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * @return GeneratorListenerInterface |
|
142 | + */ |
|
143 | + public function getGeneratorEventDispatcher(): GeneratorListenerInterface |
|
144 | + { |
|
145 | + return $this->generatorEventDispatcher; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * Creates a unique cache key for the current connection. |
|
152 | + * |
|
153 | + * @return string |
|
154 | + */ |
|
155 | + private function getConnectionUniqueId(): string |
|
156 | + { |
|
157 | + return hash('md4', $this->connection->getHost().'-'.$this->connection->getPort().'-'.$this->connection->getDatabase().'-'.$this->connection->getDriver()->getName()); |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * @return null|string |
|
162 | + */ |
|
163 | + public function getCustomComposerFile() : ?string |
|
164 | + { |
|
165 | + return $this->customComposerFile; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * @param null|string $customComposerFile |
|
170 | + */ |
|
171 | + public function setCustomComposerFile($customComposerFile) |
|
172 | + { |
|
173 | + $this->customComposerFile = $customComposerFile; |
|
174 | + } |
|
175 | 175 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * @return LoggerInterface |
134 | 134 | */ |
135 | - public function getLogger(): ?LoggerInterface |
|
135 | + public function getLogger(): ? LoggerInterface |
|
136 | 136 | { |
137 | 137 | return $this->logger; |
138 | 138 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * @return null|string |
162 | 162 | */ |
163 | - public function getCustomComposerFile() : ?string |
|
163 | + public function getCustomComposerFile() : ? string |
|
164 | 164 | { |
165 | 165 | return $this->customComposerFile; |
166 | 166 | } |
@@ -11,43 +11,43 @@ |
||
11 | 11 | |
12 | 12 | interface ConfigurationInterface |
13 | 13 | { |
14 | - /** |
|
15 | - * @return string |
|
16 | - */ |
|
17 | - public function getBeanNamespace(): string; |
|
18 | - |
|
19 | - /** |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - public function getDaoNamespace(): string; |
|
23 | - |
|
24 | - /** |
|
25 | - * @return Connection |
|
26 | - */ |
|
27 | - public function getConnection(): Connection; |
|
28 | - |
|
29 | - /** |
|
30 | - * @return Cache |
|
31 | - */ |
|
32 | - public function getCache(): Cache; |
|
33 | - |
|
34 | - /** |
|
35 | - * @return NamingStrategyInterface |
|
36 | - */ |
|
37 | - public function getNamingStrategy(): NamingStrategyInterface; |
|
38 | - |
|
39 | - /** |
|
40 | - * @return SchemaAnalyzer |
|
41 | - */ |
|
42 | - public function getSchemaAnalyzer(): SchemaAnalyzer; |
|
43 | - |
|
44 | - /** |
|
45 | - * @return LoggerInterface |
|
46 | - */ |
|
47 | - public function getLogger(): ?LoggerInterface; |
|
48 | - |
|
49 | - /** |
|
50 | - * @return GeneratorListenerInterface |
|
51 | - */ |
|
52 | - public function getGeneratorEventDispatcher(): GeneratorListenerInterface; |
|
14 | + /** |
|
15 | + * @return string |
|
16 | + */ |
|
17 | + public function getBeanNamespace(): string; |
|
18 | + |
|
19 | + /** |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + public function getDaoNamespace(): string; |
|
23 | + |
|
24 | + /** |
|
25 | + * @return Connection |
|
26 | + */ |
|
27 | + public function getConnection(): Connection; |
|
28 | + |
|
29 | + /** |
|
30 | + * @return Cache |
|
31 | + */ |
|
32 | + public function getCache(): Cache; |
|
33 | + |
|
34 | + /** |
|
35 | + * @return NamingStrategyInterface |
|
36 | + */ |
|
37 | + public function getNamingStrategy(): NamingStrategyInterface; |
|
38 | + |
|
39 | + /** |
|
40 | + * @return SchemaAnalyzer |
|
41 | + */ |
|
42 | + public function getSchemaAnalyzer(): SchemaAnalyzer; |
|
43 | + |
|
44 | + /** |
|
45 | + * @return LoggerInterface |
|
46 | + */ |
|
47 | + public function getLogger(): ?LoggerInterface; |
|
48 | + |
|
49 | + /** |
|
50 | + * @return GeneratorListenerInterface |
|
51 | + */ |
|
52 | + public function getGeneratorEventDispatcher(): GeneratorListenerInterface; |
|
53 | 53 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | /** |
45 | 45 | * @return LoggerInterface |
46 | 46 | */ |
47 | - public function getLogger(): ?LoggerInterface; |
|
47 | + public function getLogger(): ? LoggerInterface; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @return GeneratorListenerInterface |
@@ -8,7 +8,7 @@ |
||
8 | 8 | <input type="hidden" id="selfedit" name="selfedit" value="<?php echo plainstring_to_htmlprotected($this->selfedit) ?>" /> |
9 | 9 | |
10 | 10 | <?php if (!$this->autoloadDetected) { |
11 | - ?> |
|
11 | + ?> |
|
12 | 12 | <div class="alert">Warning! TDBM could not detect the autoload section of your composer.json file. |
13 | 13 | Unless you are developing your own autoload system, you should configure <strong>composer.json</strong> to <a href="http://getcomposer.org/doc/01-basic-usage.md#autoloading" target="_blank">define a source directory and a root namespace using PSR-0</a>.</div> |
14 | 14 | <?php |