@@ -207,7 +207,7 @@ |
||
| 207 | 207 | if (strlen($alias) <= 30) { // Older oracle version had a limit of 30 characters for identifiers |
| 208 | 208 | return $alias; |
| 209 | 209 | } |
| 210 | - return substr($columnName, 0, 20) . crc32($tableName.'____'.$columnName); |
|
| 210 | + return substr($columnName, 0, 20).crc32($tableName.'____'.$columnName); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | abstract protected function compute(): void; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function createResultIterator(QueryFactory $queryFactory, array $parameters, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self |
| 86 | 86 | { |
| 87 | - $iterator = new static(); |
|
| 87 | + $iterator = new static(); |
|
| 88 | 88 | if ($mode !== TDBMService::MODE_CURSOR && $mode !== TDBMService::MODE_ARRAY) { |
| 89 | 89 | throw new TDBMException("Unknown fetch mode: '".$mode."'"); |
| 90 | 90 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | public function jsonSerialize($stopRecursion = false) |
| 283 | 283 | { |
| 284 | - return array_map(function (AbstractTDBMObject $item) use ($stopRecursion) { |
|
| 284 | + return array_map(function(AbstractTDBMObject $item) use ($stopRecursion) { |
|
| 285 | 285 | return $item->jsonSerialize($stopRecursion); |
| 286 | 286 | }, $this->toArray()); |
| 287 | 287 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | public function getIncomingForeignKeys(string $tableName): array |
| 143 | 143 | { |
| 144 | 144 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(true); |
| 145 | - $junctionTableNames = array_map(function (Table $table) { |
|
| 145 | + $junctionTableNames = array_map(function(Table $table) { |
|
| 146 | 146 | return $table->getName(); |
| 147 | 147 | }, $junctionTables); |
| 148 | 148 | $childrenRelationships = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | $fromLock = (bool) $input->getOption('from-lock'); |
| 51 | 51 | |
| 52 | - $loggers = [ new ConsoleLogger($output) ]; |
|
| 52 | + $loggers = [new ConsoleLogger($output)]; |
|
| 53 | 53 | |
| 54 | 54 | $logger = $alteredConf->getLogger(); |
| 55 | 55 | if ($logger) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function createResultIterator(ResultIterator $parentResult, string $magicSql, array $parameters, int $limit, int $offset, array $columnDescriptors, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self |
| 80 | 80 | { |
| 81 | - $iterator = new self(); |
|
| 81 | + $iterator = new self(); |
|
| 82 | 82 | $iterator->parentResult = $parentResult; |
| 83 | 83 | $iterator->magicSql = $magicSql; |
| 84 | 84 | $iterator->objectStorage = $objectStorage; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function jsonSerialize() |
| 279 | 279 | { |
| 280 | - return array_map(function (AbstractTDBMObject $item) { |
|
| 280 | + return array_map(function(AbstractTDBMObject $item) { |
|
| 281 | 281 | return $item->jsonSerialize(); |
| 282 | 282 | }, $this->toArray()); |
| 283 | 283 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | public static function createInnerResultIterator(string $magicSql, array $parameters, ?int $limit, ?int $offset, array $columnDescriptors, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, LoggerInterface $logger): self |
| 80 | 80 | { |
| 81 | - $iterator = new static(); |
|
| 81 | + $iterator = new static(); |
|
| 82 | 82 | $iterator->magicSql = $magicSql; |
| 83 | 83 | $iterator->objectStorage = $objectStorage; |
| 84 | 84 | $iterator->className = $className; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public static function getValidVariableName(string $variableName): string |
| 10 | 10 | { |
| 11 | - $valid = preg_replace_callback('/^(\d+)/', static function (array $match) { |
|
| 11 | + $valid = preg_replace_callback('/^(\d+)/', static function(array $match) { |
|
| 12 | 12 | $f = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); |
| 13 | 13 | $number = $f->format((int) $match[0]); |
| 14 | 14 | return preg_replace('/[^a-z]+/i', '_', $number); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $alias = AbstractQueryFactory::getColumnAlias($tableName, $columnName); |
| 216 | 216 | $astColumn = [ |
| 217 | 217 | 'expr_type' => 'colref', |
| 218 | - 'base_expr' => $connection->quoteIdentifier($tableName) . '.' . $connection->quoteIdentifier($columnName), |
|
| 218 | + 'base_expr' => $connection->quoteIdentifier($tableName).'.'.$connection->quoteIdentifier($columnName), |
|
| 219 | 219 | 'no_quotes' => [ |
| 220 | 220 | 'delim' => '.', |
| 221 | 221 | 'parts' => [ |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | return $this->generateWrappedSqlCount($parsedSql); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - $countSubExpr = array_map(function (array $item) { |
|
| 306 | + $countSubExpr = array_map(function(array $item) { |
|
| 307 | 307 | unset($item['alias']); |
| 308 | 308 | return $item; |
| 309 | 309 | }, $parsedSql['SELECT']); |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $item['delim'] = ','; |
| 381 | 381 | $innerColumns[] = $item; |
| 382 | 382 | } |
| 383 | - $innerColumns[count($innerColumns)-1]['delim'] = false; |
|
| 383 | + $innerColumns[count($innerColumns) - 1]['delim'] = false; |
|
| 384 | 384 | $parsedSql['SELECT'] = $innerColumns; |
| 385 | 385 | |
| 386 | 386 | $parsedSql = [ |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath()); |
| 111 | 111 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
| 112 | 112 | $this->tdbmDaoGenerator = new TDBMDaoGenerator($this->getConfiguration(), $tdbmSchemaAnalyzer); |
| 113 | - $this->rootPath = __DIR__ . '/../'; |
|
| 113 | + $this->rootPath = __DIR__.'/../'; |
|
| 114 | 114 | //$this->tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | public function testDaoGeneration(): void |
| 133 | 133 | { |
| 134 | 134 | // Remove all previously generated files. |
| 135 | - $this->recursiveDelete($this->rootPath . 'src/Test/Dao/'); |
|
| 136 | - mkdir($this->rootPath . 'src/Test/Dao/Generated', 0755, true); |
|
| 135 | + $this->recursiveDelete($this->rootPath.'src/Test/Dao/'); |
|
| 136 | + mkdir($this->rootPath.'src/Test/Dao/Generated', 0755, true); |
|
| 137 | 137 | // Let's generate a dummy file to see it is indeed removed. |
| 138 | - $dummyFile = $this->rootPath . 'src/Test/Dao/Generated/foobar.php'; |
|
| 138 | + $dummyFile = $this->rootPath.'src/Test/Dao/Generated/foobar.php'; |
|
| 139 | 139 | touch($dummyFile); |
| 140 | 140 | $this->assertFileExists($dummyFile); |
| 141 | 141 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | // Let's require all files to check they are valid PHP! |
| 156 | 156 | // Test the daoFactory |
| 157 | - require_once $this->rootPath . 'src/Test/Dao/Generated/DaoFactory.php'; |
|
| 157 | + require_once $this->rootPath.'src/Test/Dao/Generated/DaoFactory.php'; |
|
| 158 | 158 | // Test the others |
| 159 | 159 | |
| 160 | 160 | $beanDescriptors = $this->getDummyGeneratorListener()->getBeanDescriptors(); |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | $daoBaseName = $beanDescriptor->getBaseDaoClassName(); |
| 165 | 165 | $beanName = $beanDescriptor->getBeanClassName(); |
| 166 | 166 | $baseBeanName = $beanDescriptor->getBaseBeanClassName(); |
| 167 | - require_once $this->rootPath . 'src/Test/Dao/Bean/Generated/' . $baseBeanName . '.php'; |
|
| 168 | - require_once $this->rootPath . 'src/Test/Dao/Bean/' . $beanName . '.php'; |
|
| 169 | - require_once $this->rootPath . 'src/Test/Dao/Generated/' . $daoBaseName . '.php'; |
|
| 170 | - require_once $this->rootPath . 'src/Test/Dao/' . $daoName . '.php'; |
|
| 167 | + require_once $this->rootPath.'src/Test/Dao/Bean/Generated/'.$baseBeanName.'.php'; |
|
| 168 | + require_once $this->rootPath.'src/Test/Dao/Bean/'.$beanName.'.php'; |
|
| 169 | + require_once $this->rootPath.'src/Test/Dao/Generated/'.$daoBaseName.'.php'; |
|
| 170 | + require_once $this->rootPath.'src/Test/Dao/'.$daoName.'.php'; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Check that pivot tables do not generate DAOs or beans. |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath()); |
| 184 | 184 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
| 185 | 185 | $tdbmDaoGenerator = new TDBMDaoGenerator($configuration, $tdbmSchemaAnalyzer); |
| 186 | - $this->rootPath = __DIR__ . '/../../../../'; |
|
| 186 | + $this->rootPath = __DIR__.'/../../../../'; |
|
| 187 | 187 | //$tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
| 188 | 188 | |
| 189 | 189 | $this->expectException(NoPathFoundException::class); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if (is_file($str)) { |
| 202 | 202 | return @unlink($str); |
| 203 | 203 | } elseif (is_dir($str)) { |
| 204 | - $scan = glob(rtrim($str, '/') . '/*'); |
|
| 204 | + $scan = glob(rtrim($str, '/').'/*'); |
|
| 205 | 205 | foreach ($scan as $index => $path) { |
| 206 | 206 | $this->recursiveDelete($path); |
| 207 | 207 | } |
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | |
| 2038 | 2038 | $artists = new ArtistDao($this->tdbmService); |
| 2039 | 2039 | $pinkFloyd = $artists->getById(1); |
| 2040 | - $animals = $pinkFloyd->getAlbums()[0]; |
|
| 2040 | + $animals = $pinkFloyd->getAlbums()[0]; |
|
| 2041 | 2041 | $json = $pinkFloyd->jsonSerialize(); |
| 2042 | 2042 | // Collection name properly handled ('discography' instead of default 'albums') |
| 2043 | 2043 | self::assertTrue(isset($json['discography'])); |