@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $alteredConf = new AlteredConfiguration($this->configuration); |
| 40 | 40 | |
| 41 | 41 | |
| 42 | - $loggers = [ new ConsoleLogger($output) ]; |
|
| 42 | + $loggers = [new ConsoleLogger($output)]; |
|
| 43 | 43 | |
| 44 | 44 | $logger = $alteredConf->getLogger(); |
| 45 | 45 | if ($logger) { |
@@ -12,48 +12,48 @@ |
||
| 12 | 12 | class GenerateCommand extends Command |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @var ConfigurationInterface |
|
| 17 | - */ |
|
| 18 | - private $configuration; |
|
| 15 | + /** |
|
| 16 | + * @var ConfigurationInterface |
|
| 17 | + */ |
|
| 18 | + private $configuration; |
|
| 19 | 19 | |
| 20 | - public function __construct(ConfigurationInterface $configuration) |
|
| 21 | - { |
|
| 22 | - parent::__construct(); |
|
| 23 | - $this->configuration = $configuration; |
|
| 24 | - } |
|
| 20 | + public function __construct(ConfigurationInterface $configuration) |
|
| 21 | + { |
|
| 22 | + parent::__construct(); |
|
| 23 | + $this->configuration = $configuration; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - protected function configure() |
|
| 27 | - { |
|
| 28 | - $this->setName('tdbm:generate') |
|
| 29 | - ->setDescription('Generates DAOs and beans.') |
|
| 30 | - ->setHelp('Use this command to generate or regenerate the DAOs and beans for your project.') |
|
| 31 | - ; |
|
| 32 | - } |
|
| 26 | + protected function configure() |
|
| 27 | + { |
|
| 28 | + $this->setName('tdbm:generate') |
|
| 29 | + ->setDescription('Generates DAOs and beans.') |
|
| 30 | + ->setHelp('Use this command to generate or regenerate the DAOs and beans for your project.') |
|
| 31 | + ; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | - { |
|
| 36 | - // TODO: externalize composer.json file for autoloading (no more parameters for generateAllDaosAndBeans) |
|
| 34 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | + { |
|
| 36 | + // TODO: externalize composer.json file for autoloading (no more parameters for generateAllDaosAndBeans) |
|
| 37 | 37 | |
| 38 | - $alteredConf = new AlteredConfiguration($this->configuration); |
|
| 38 | + $alteredConf = new AlteredConfiguration($this->configuration); |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - $loggers = [ new ConsoleLogger($output) ]; |
|
| 41 | + $loggers = [ new ConsoleLogger($output) ]; |
|
| 42 | 42 | |
| 43 | - $logger = $alteredConf->getLogger(); |
|
| 44 | - if ($logger) { |
|
| 45 | - $loggers[] = $logger; |
|
| 46 | - } |
|
| 43 | + $logger = $alteredConf->getLogger(); |
|
| 44 | + if ($logger) { |
|
| 45 | + $loggers[] = $logger; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $multiLogger = new MultiLogger($loggers); |
|
| 48 | + $multiLogger = new MultiLogger($loggers); |
|
| 49 | 49 | |
| 50 | - $alteredConf->setLogger($multiLogger); |
|
| 50 | + $alteredConf->setLogger($multiLogger); |
|
| 51 | 51 | |
| 52 | - $multiLogger->notice('Starting regenerating DAOs and beans'); |
|
| 52 | + $multiLogger->notice('Starting regenerating DAOs and beans'); |
|
| 53 | 53 | |
| 54 | - $tdbmService = new TDBMService($this->configuration); |
|
| 55 | - $tdbmService->generateAllDaosAndBeans(); |
|
| 54 | + $tdbmService = new TDBMService($this->configuration); |
|
| 55 | + $tdbmService->generateAllDaosAndBeans(); |
|
| 56 | 56 | |
| 57 | - $multiLogger->notice('Finished regenerating DAOs and beans'); |
|
| 58 | - } |
|
| 57 | + $multiLogger->notice('Finished regenerating DAOs and beans'); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | /** |
| 136 | 136 | * @return LoggerInterface |
| 137 | 137 | */ |
| 138 | - public function getLogger(): ?LoggerInterface |
|
| 138 | + public function getLogger(): ? LoggerInterface |
|
| 139 | 139 | { |
| 140 | 140 | return $this->logger; |
| 141 | 141 | } |
@@ -17,165 +17,165 @@ |
||
| 17 | 17 | class Configuration implements ConfigurationInterface |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - private $beanNamespace; |
|
| 24 | - /** |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - private $daoNamespace; |
|
| 28 | - /** |
|
| 29 | - * @var Connection |
|
| 30 | - */ |
|
| 31 | - private $connection; |
|
| 32 | - /** |
|
| 33 | - * @var Cache |
|
| 34 | - */ |
|
| 35 | - private $cache; |
|
| 36 | - /** |
|
| 37 | - * @var SchemaAnalyzer |
|
| 38 | - */ |
|
| 39 | - private $schemaAnalyzer; |
|
| 40 | - /** |
|
| 41 | - * @var LoggerInterface |
|
| 42 | - */ |
|
| 43 | - private $logger; |
|
| 44 | - /** |
|
| 45 | - * @var GeneratorListenerInterface |
|
| 46 | - */ |
|
| 47 | - private $generatorEventDispatcher; |
|
| 48 | - /** |
|
| 49 | - * @var NamingStrategyInterface |
|
| 50 | - */ |
|
| 51 | - private $namingStrategy; |
|
| 52 | - /** |
|
| 53 | - * @var PathFinderInterface |
|
| 54 | - */ |
|
| 55 | - private $pathFinder; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @param string $beanNamespace The namespace hosting the beans |
|
| 59 | - * @param string $daoNamespace The namespace hosting the DAOs |
|
| 60 | - * @param Connection $connection The connection to the database |
|
| 61 | - * @param Cache|null $cache The Doctrine cache to store database metadata |
|
| 62 | - * @param SchemaAnalyzer|null $schemaAnalyzer The schema analyzer that will be used to find shortest paths... Will be automatically created if not passed |
|
| 63 | - * @param LoggerInterface|null $logger The logger |
|
| 64 | - * @param GeneratorListenerInterface[] $generatorListeners A list of listeners that will be triggered when beans/daos are generated |
|
| 65 | - */ |
|
| 66 | - public function __construct(string $beanNamespace, string $daoNamespace, Connection $connection, NamingStrategyInterface $namingStrategy, Cache $cache = null, SchemaAnalyzer $schemaAnalyzer = null, LoggerInterface $logger = null, array $generatorListeners = []) |
|
| 67 | - { |
|
| 68 | - $this->beanNamespace = rtrim($beanNamespace, '\\'); |
|
| 69 | - $this->daoNamespace = rtrim($daoNamespace, '\\'); |
|
| 70 | - $this->connection = $connection; |
|
| 71 | - $this->namingStrategy = $namingStrategy; |
|
| 72 | - if ($cache !== null) { |
|
| 73 | - $this->cache = $cache; |
|
| 74 | - } else { |
|
| 75 | - $this->cache = new VoidCache(); |
|
| 76 | - } |
|
| 77 | - if ($schemaAnalyzer !== null) { |
|
| 78 | - $this->schemaAnalyzer = $schemaAnalyzer; |
|
| 79 | - } else { |
|
| 80 | - $this->schemaAnalyzer = new SchemaAnalyzer($this->connection->getSchemaManager(), $this->cache, $this->getConnectionUniqueId()); |
|
| 81 | - } |
|
| 82 | - $this->logger = $logger; |
|
| 83 | - $this->generatorEventDispatcher = new GeneratorEventDispatcher($generatorListeners); |
|
| 84 | - $this->pathFinder = new PathFinder(); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * @return string |
|
| 89 | - */ |
|
| 90 | - public function getBeanNamespace(): string |
|
| 91 | - { |
|
| 92 | - return $this->beanNamespace; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function getDaoNamespace(): string |
|
| 99 | - { |
|
| 100 | - return $this->daoNamespace; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @return Connection |
|
| 105 | - */ |
|
| 106 | - public function getConnection(): Connection |
|
| 107 | - { |
|
| 108 | - return $this->connection; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @return NamingStrategyInterface |
|
| 113 | - */ |
|
| 114 | - public function getNamingStrategy(): NamingStrategyInterface |
|
| 115 | - { |
|
| 116 | - return $this->namingStrategy; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @return Cache |
|
| 121 | - */ |
|
| 122 | - public function getCache(): Cache |
|
| 123 | - { |
|
| 124 | - return $this->cache; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @return SchemaAnalyzer |
|
| 129 | - */ |
|
| 130 | - public function getSchemaAnalyzer(): SchemaAnalyzer |
|
| 131 | - { |
|
| 132 | - return $this->schemaAnalyzer; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * @return LoggerInterface |
|
| 137 | - */ |
|
| 138 | - public function getLogger(): ?LoggerInterface |
|
| 139 | - { |
|
| 140 | - return $this->logger; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * @return GeneratorListenerInterface |
|
| 145 | - */ |
|
| 146 | - public function getGeneratorEventDispatcher(): GeneratorListenerInterface |
|
| 147 | - { |
|
| 148 | - return $this->generatorEventDispatcher; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Creates a unique cache key for the current connection. |
|
| 155 | - * |
|
| 156 | - * @return string |
|
| 157 | - */ |
|
| 158 | - private function getConnectionUniqueId(): string |
|
| 159 | - { |
|
| 160 | - return hash('md4', $this->connection->getHost().'-'.$this->connection->getPort().'-'.$this->connection->getDatabase().'-'.$this->connection->getDriver()->getName()); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * Returns a class able to find the place of a PHP file based on the class name. |
|
| 165 | - * Useful to find the path where DAOs and beans should be written to. |
|
| 166 | - * |
|
| 167 | - * @return PathFinderInterface |
|
| 168 | - */ |
|
| 169 | - public function getPathFinder(): PathFinderInterface |
|
| 170 | - { |
|
| 171 | - return $this->pathFinder; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * @param PathFinderInterface $pathFinder |
|
| 176 | - */ |
|
| 177 | - public function setPathFinder(PathFinderInterface $pathFinder) |
|
| 178 | - { |
|
| 179 | - $this->pathFinder = $pathFinder; |
|
| 180 | - } |
|
| 20 | + /** |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + private $beanNamespace; |
|
| 24 | + /** |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + private $daoNamespace; |
|
| 28 | + /** |
|
| 29 | + * @var Connection |
|
| 30 | + */ |
|
| 31 | + private $connection; |
|
| 32 | + /** |
|
| 33 | + * @var Cache |
|
| 34 | + */ |
|
| 35 | + private $cache; |
|
| 36 | + /** |
|
| 37 | + * @var SchemaAnalyzer |
|
| 38 | + */ |
|
| 39 | + private $schemaAnalyzer; |
|
| 40 | + /** |
|
| 41 | + * @var LoggerInterface |
|
| 42 | + */ |
|
| 43 | + private $logger; |
|
| 44 | + /** |
|
| 45 | + * @var GeneratorListenerInterface |
|
| 46 | + */ |
|
| 47 | + private $generatorEventDispatcher; |
|
| 48 | + /** |
|
| 49 | + * @var NamingStrategyInterface |
|
| 50 | + */ |
|
| 51 | + private $namingStrategy; |
|
| 52 | + /** |
|
| 53 | + * @var PathFinderInterface |
|
| 54 | + */ |
|
| 55 | + private $pathFinder; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @param string $beanNamespace The namespace hosting the beans |
|
| 59 | + * @param string $daoNamespace The namespace hosting the DAOs |
|
| 60 | + * @param Connection $connection The connection to the database |
|
| 61 | + * @param Cache|null $cache The Doctrine cache to store database metadata |
|
| 62 | + * @param SchemaAnalyzer|null $schemaAnalyzer The schema analyzer that will be used to find shortest paths... Will be automatically created if not passed |
|
| 63 | + * @param LoggerInterface|null $logger The logger |
|
| 64 | + * @param GeneratorListenerInterface[] $generatorListeners A list of listeners that will be triggered when beans/daos are generated |
|
| 65 | + */ |
|
| 66 | + public function __construct(string $beanNamespace, string $daoNamespace, Connection $connection, NamingStrategyInterface $namingStrategy, Cache $cache = null, SchemaAnalyzer $schemaAnalyzer = null, LoggerInterface $logger = null, array $generatorListeners = []) |
|
| 67 | + { |
|
| 68 | + $this->beanNamespace = rtrim($beanNamespace, '\\'); |
|
| 69 | + $this->daoNamespace = rtrim($daoNamespace, '\\'); |
|
| 70 | + $this->connection = $connection; |
|
| 71 | + $this->namingStrategy = $namingStrategy; |
|
| 72 | + if ($cache !== null) { |
|
| 73 | + $this->cache = $cache; |
|
| 74 | + } else { |
|
| 75 | + $this->cache = new VoidCache(); |
|
| 76 | + } |
|
| 77 | + if ($schemaAnalyzer !== null) { |
|
| 78 | + $this->schemaAnalyzer = $schemaAnalyzer; |
|
| 79 | + } else { |
|
| 80 | + $this->schemaAnalyzer = new SchemaAnalyzer($this->connection->getSchemaManager(), $this->cache, $this->getConnectionUniqueId()); |
|
| 81 | + } |
|
| 82 | + $this->logger = $logger; |
|
| 83 | + $this->generatorEventDispatcher = new GeneratorEventDispatcher($generatorListeners); |
|
| 84 | + $this->pathFinder = new PathFinder(); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * @return string |
|
| 89 | + */ |
|
| 90 | + public function getBeanNamespace(): string |
|
| 91 | + { |
|
| 92 | + return $this->beanNamespace; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function getDaoNamespace(): string |
|
| 99 | + { |
|
| 100 | + return $this->daoNamespace; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @return Connection |
|
| 105 | + */ |
|
| 106 | + public function getConnection(): Connection |
|
| 107 | + { |
|
| 108 | + return $this->connection; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @return NamingStrategyInterface |
|
| 113 | + */ |
|
| 114 | + public function getNamingStrategy(): NamingStrategyInterface |
|
| 115 | + { |
|
| 116 | + return $this->namingStrategy; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @return Cache |
|
| 121 | + */ |
|
| 122 | + public function getCache(): Cache |
|
| 123 | + { |
|
| 124 | + return $this->cache; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @return SchemaAnalyzer |
|
| 129 | + */ |
|
| 130 | + public function getSchemaAnalyzer(): SchemaAnalyzer |
|
| 131 | + { |
|
| 132 | + return $this->schemaAnalyzer; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * @return LoggerInterface |
|
| 137 | + */ |
|
| 138 | + public function getLogger(): ?LoggerInterface |
|
| 139 | + { |
|
| 140 | + return $this->logger; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * @return GeneratorListenerInterface |
|
| 145 | + */ |
|
| 146 | + public function getGeneratorEventDispatcher(): GeneratorListenerInterface |
|
| 147 | + { |
|
| 148 | + return $this->generatorEventDispatcher; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Creates a unique cache key for the current connection. |
|
| 155 | + * |
|
| 156 | + * @return string |
|
| 157 | + */ |
|
| 158 | + private function getConnectionUniqueId(): string |
|
| 159 | + { |
|
| 160 | + return hash('md4', $this->connection->getHost().'-'.$this->connection->getPort().'-'.$this->connection->getDatabase().'-'.$this->connection->getDriver()->getName()); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * Returns a class able to find the place of a PHP file based on the class name. |
|
| 165 | + * Useful to find the path where DAOs and beans should be written to. |
|
| 166 | + * |
|
| 167 | + * @return PathFinderInterface |
|
| 168 | + */ |
|
| 169 | + public function getPathFinder(): PathFinderInterface |
|
| 170 | + { |
|
| 171 | + return $this->pathFinder; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * @param PathFinderInterface $pathFinder |
|
| 176 | + */ |
|
| 177 | + public function setPathFinder(PathFinderInterface $pathFinder) |
|
| 178 | + { |
|
| 179 | + $this->pathFinder = $pathFinder; |
|
| 180 | + } |
|
| 181 | 181 | } |
@@ -5,12 +5,12 @@ |
||
| 5 | 5 | |
| 6 | 6 | interface PathFinderInterface |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Returns the path of a class file given the fully qualified class name. |
|
| 10 | - * |
|
| 11 | - * @param string $className |
|
| 12 | - * @return \SplFileInfo |
|
| 13 | - * @throws NoPathFoundException |
|
| 14 | - */ |
|
| 15 | - public function getPath(string $className) : \SplFileInfo; |
|
| 8 | + /** |
|
| 9 | + * Returns the path of a class file given the fully qualified class name. |
|
| 10 | + * |
|
| 11 | + * @param string $className |
|
| 12 | + * @return \SplFileInfo |
|
| 13 | + * @throws NoPathFoundException |
|
| 14 | + */ |
|
| 15 | + public function getPath(string $className) : \SplFileInfo; |
|
| 16 | 16 | } |
@@ -5,48 +5,48 @@ |
||
| 5 | 5 | |
| 6 | 6 | class PathFinder implements PathFinderInterface |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * @var string |
|
| 10 | - */ |
|
| 11 | - private $composerFile; |
|
| 8 | + /** |
|
| 9 | + * @var string |
|
| 10 | + */ |
|
| 11 | + private $composerFile; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @var bool |
|
| 15 | - */ |
|
| 16 | - private $useAutoloadDev; |
|
| 13 | + /** |
|
| 14 | + * @var bool |
|
| 15 | + */ |
|
| 16 | + private $useAutoloadDev; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var ClassNameMapper |
|
| 20 | - */ |
|
| 21 | - private $classNameMapper; |
|
| 18 | + /** |
|
| 19 | + * @var ClassNameMapper |
|
| 20 | + */ |
|
| 21 | + private $classNameMapper; |
|
| 22 | 22 | |
| 23 | - public function __construct(string $composerFile = null, bool $useAutoloadDev = false) |
|
| 24 | - { |
|
| 25 | - $this->composerFile = $composerFile; |
|
| 26 | - $this->useAutoloadDev = $useAutoloadDev; |
|
| 27 | - } |
|
| 23 | + public function __construct(string $composerFile = null, bool $useAutoloadDev = false) |
|
| 24 | + { |
|
| 25 | + $this->composerFile = $composerFile; |
|
| 26 | + $this->useAutoloadDev = $useAutoloadDev; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - private function getClassNameMapper() : ClassNameMapper |
|
| 30 | - { |
|
| 31 | - if ($this->classNameMapper === null) { |
|
| 32 | - $this->classNameMapper = ClassNameMapper::createFromComposerFile($this->composerFile, null, $this->useAutoloadDev); |
|
| 33 | - } |
|
| 34 | - return $this->classNameMapper; |
|
| 35 | - } |
|
| 29 | + private function getClassNameMapper() : ClassNameMapper |
|
| 30 | + { |
|
| 31 | + if ($this->classNameMapper === null) { |
|
| 32 | + $this->classNameMapper = ClassNameMapper::createFromComposerFile($this->composerFile, null, $this->useAutoloadDev); |
|
| 33 | + } |
|
| 34 | + return $this->classNameMapper; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Returns the path of a class file given the fully qualified class name. |
|
| 39 | - * |
|
| 40 | - * @param string $className |
|
| 41 | - * @return \SplFileInfo |
|
| 42 | - * @throws NoPathFoundException |
|
| 43 | - */ |
|
| 44 | - public function getPath(string $className): \SplFileInfo |
|
| 45 | - { |
|
| 46 | - $paths = $this->getClassNameMapper()->getPossibleFileNames($className); |
|
| 47 | - if (empty($paths)) { |
|
| 48 | - throw NoPathFoundException::create($className); |
|
| 49 | - } |
|
| 50 | - return new \SplFileInfo($paths[0]); |
|
| 51 | - } |
|
| 37 | + /** |
|
| 38 | + * Returns the path of a class file given the fully qualified class name. |
|
| 39 | + * |
|
| 40 | + * @param string $className |
|
| 41 | + * @return \SplFileInfo |
|
| 42 | + * @throws NoPathFoundException |
|
| 43 | + */ |
|
| 44 | + public function getPath(string $className): \SplFileInfo |
|
| 45 | + { |
|
| 46 | + $paths = $this->getClassNameMapper()->getPossibleFileNames($className); |
|
| 47 | + if (empty($paths)) { |
|
| 48 | + throw NoPathFoundException::create($className); |
|
| 49 | + } |
|
| 50 | + return new \SplFileInfo($paths[0]); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class NoPathFoundException extends TDBMException |
| 12 | 12 | { |
| 13 | - public static function create(string $className) |
|
| 14 | - { |
|
| 15 | - return new self(sprintf('Could not find a path where class %s would be autoloadable. Maybe consider editing your composer.json autoload section accordingly.', $className)); |
|
| 16 | - } |
|
| 13 | + public static function create(string $className) |
|
| 14 | + { |
|
| 15 | + return new self(sprintf('Could not find a path where class %s would be autoloadable. Maybe consider editing your composer.json autoload section accordingly.', $className)); |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -20,103 +20,103 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class AlteredConfiguration implements ConfigurationInterface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var ConfigurationInterface |
|
| 25 | - */ |
|
| 26 | - private $configuration; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var LoggerInterface |
|
| 30 | - */ |
|
| 31 | - private $logger; |
|
| 32 | - |
|
| 33 | - public function __construct(ConfigurationInterface $configuration) |
|
| 34 | - { |
|
| 35 | - $this->configuration = $configuration; |
|
| 36 | - $this->logger = $configuration->getLogger(); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function getBeanNamespace(): string |
|
| 44 | - { |
|
| 45 | - return $this->configuration->getBeanNamespace(); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @return string |
|
| 50 | - */ |
|
| 51 | - public function getDaoNamespace(): string |
|
| 52 | - { |
|
| 53 | - return $this->configuration->getDaoNamespace(); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @return Connection |
|
| 58 | - */ |
|
| 59 | - public function getConnection(): Connection |
|
| 60 | - { |
|
| 61 | - return $this->configuration->getConnection(); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @return Cache |
|
| 66 | - */ |
|
| 67 | - public function getCache(): Cache |
|
| 68 | - { |
|
| 69 | - return $this->configuration->getCache(); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * @return NamingStrategyInterface |
|
| 74 | - */ |
|
| 75 | - public function getNamingStrategy(): NamingStrategyInterface |
|
| 76 | - { |
|
| 77 | - return $this->configuration->getNamingStrategy(); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * @return SchemaAnalyzer |
|
| 82 | - */ |
|
| 83 | - public function getSchemaAnalyzer(): SchemaAnalyzer |
|
| 84 | - { |
|
| 85 | - return $this->configuration->getSchemaAnalyzer(); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @return LoggerInterface |
|
| 90 | - */ |
|
| 91 | - public function getLogger(): ?LoggerInterface |
|
| 92 | - { |
|
| 93 | - return $this->logger; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * @return GeneratorListenerInterface |
|
| 98 | - */ |
|
| 99 | - public function getGeneratorEventDispatcher(): GeneratorListenerInterface |
|
| 100 | - { |
|
| 101 | - return $this->configuration->getGeneratorEventDispatcher(); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @param LoggerInterface $logger |
|
| 106 | - */ |
|
| 107 | - public function setLogger(LoggerInterface $logger) |
|
| 108 | - { |
|
| 109 | - $this->logger = $logger; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Returns a class able to find the place of a PHP file based on the class name. |
|
| 114 | - * Useful to find the path where DAOs and beans should be written to. |
|
| 115 | - * |
|
| 116 | - * @return PathFinderInterface |
|
| 117 | - */ |
|
| 118 | - public function getPathFinder(): PathFinderInterface |
|
| 119 | - { |
|
| 120 | - return $this->configuration->getPathFinder(); |
|
| 121 | - } |
|
| 23 | + /** |
|
| 24 | + * @var ConfigurationInterface |
|
| 25 | + */ |
|
| 26 | + private $configuration; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var LoggerInterface |
|
| 30 | + */ |
|
| 31 | + private $logger; |
|
| 32 | + |
|
| 33 | + public function __construct(ConfigurationInterface $configuration) |
|
| 34 | + { |
|
| 35 | + $this->configuration = $configuration; |
|
| 36 | + $this->logger = $configuration->getLogger(); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function getBeanNamespace(): string |
|
| 44 | + { |
|
| 45 | + return $this->configuration->getBeanNamespace(); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @return string |
|
| 50 | + */ |
|
| 51 | + public function getDaoNamespace(): string |
|
| 52 | + { |
|
| 53 | + return $this->configuration->getDaoNamespace(); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @return Connection |
|
| 58 | + */ |
|
| 59 | + public function getConnection(): Connection |
|
| 60 | + { |
|
| 61 | + return $this->configuration->getConnection(); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @return Cache |
|
| 66 | + */ |
|
| 67 | + public function getCache(): Cache |
|
| 68 | + { |
|
| 69 | + return $this->configuration->getCache(); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * @return NamingStrategyInterface |
|
| 74 | + */ |
|
| 75 | + public function getNamingStrategy(): NamingStrategyInterface |
|
| 76 | + { |
|
| 77 | + return $this->configuration->getNamingStrategy(); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * @return SchemaAnalyzer |
|
| 82 | + */ |
|
| 83 | + public function getSchemaAnalyzer(): SchemaAnalyzer |
|
| 84 | + { |
|
| 85 | + return $this->configuration->getSchemaAnalyzer(); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @return LoggerInterface |
|
| 90 | + */ |
|
| 91 | + public function getLogger(): ?LoggerInterface |
|
| 92 | + { |
|
| 93 | + return $this->logger; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * @return GeneratorListenerInterface |
|
| 98 | + */ |
|
| 99 | + public function getGeneratorEventDispatcher(): GeneratorListenerInterface |
|
| 100 | + { |
|
| 101 | + return $this->configuration->getGeneratorEventDispatcher(); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @param LoggerInterface $logger |
|
| 106 | + */ |
|
| 107 | + public function setLogger(LoggerInterface $logger) |
|
| 108 | + { |
|
| 109 | + $this->logger = $logger; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Returns a class able to find the place of a PHP file based on the class name. |
|
| 114 | + * Useful to find the path where DAOs and beans should be written to. |
|
| 115 | + * |
|
| 116 | + * @return PathFinderInterface |
|
| 117 | + */ |
|
| 118 | + public function getPathFinder(): PathFinderInterface |
|
| 119 | + { |
|
| 120 | + return $this->configuration->getPathFinder(); |
|
| 121 | + } |
|
| 122 | 122 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | /** |
| 136 | 136 | * @return LoggerInterface |
| 137 | 137 | */ |
| 138 | - public function getLogger(): ?LoggerInterface |
|
| 138 | + public function getLogger(): ? LoggerInterface |
|
| 139 | 139 | { |
| 140 | 140 | return $this->logger; |
| 141 | 141 | } |