@@ -21,11 +21,9 @@ |
||
| 21 | 21 | namespace Mouf\Database\TDBM; |
| 22 | 22 | |
| 23 | 23 | use Doctrine\Common\Cache\Cache; |
| 24 | -use Doctrine\Common\Cache\VoidCache; |
|
| 25 | 24 | use Doctrine\DBAL\Connection; |
| 26 | 25 | use Doctrine\DBAL\Schema\Column; |
| 27 | 26 | use Doctrine\DBAL\Schema\ForeignKeyConstraint; |
| 28 | -use Doctrine\DBAL\Schema\Schema; |
|
| 29 | 27 | use Doctrine\DBAL\Schema\Table; |
| 30 | 28 | use Doctrine\DBAL\Types\Type; |
| 31 | 29 | use Mouf\Database\MagicQuery; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | // First, are there many column or only one? |
| 79 | 79 | // If one column, we name the setter after it. Otherwise, we name the setter after the table name |
| 80 | - if (count($this->foreignKey->getLocalColumns()) > 1) { |
|
| 80 | + if (count($this->foreignKey->getLocalColumns())>1) { |
|
| 81 | 81 | $name = TDBMDaoGenerator::toSingular(TDBMDaoGenerator::toCamelCase($this->foreignKey->getForeignTableName())); |
| 82 | 82 | if ($this->alternativeName) { |
| 83 | 83 | $camelizedColumns = array_map(['Mouf\\Database\\TDBM\\Utils\\TDBMDaoGenerator', 'toCamelCase'], $this->foreignKey->getLocalColumns()); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | if (strpos(strtolower($column), 'id_') === 0) { |
| 91 | 91 | $column = substr($column, 3); |
| 92 | 92 | } |
| 93 | - if (strrpos(strtolower($column), '_id') === strlen($column) - 3) { |
|
| 94 | - $column = substr($column, 0, strlen($column) - 3); |
|
| 93 | + if (strrpos(strtolower($column), '_id') === strlen($column)-3) { |
|
| 94 | + $column = substr($column, 0, strlen($column)-3); |
|
| 95 | 95 | } |
| 96 | 96 | $name = TDBMDaoGenerator::toCamelCase($column); |
| 97 | 97 | if ($this->alternativeName) { |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | $str = ' /** |
| 178 | 178 | * Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getLocalColumns()).' column. |
| 179 | 179 | * |
| 180 | - * @return '.$referencedBeanName.($isNullable?'|null':'').' |
|
| 180 | + * @return '.$referencedBeanName.($isNullable ? '|null' : '').' |
|
| 181 | 181 | */ |
| 182 | - public function '.$getterName.'(): '.($isNullable?'?':'').$referencedBeanName.' |
|
| 182 | + public function '.$getterName.'(): '.($isNullable ? '?' : '').$referencedBeanName.' |
|
| 183 | 183 | { |
| 184 | 184 | return $this->getRef('.var_export($this->foreignKey->getName(), true).', '.var_export($tableName, true).'); |
| 185 | 185 | } |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | /** |
| 188 | 188 | * The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getLocalColumns()).' column. |
| 189 | 189 | * |
| 190 | - * @param '.$referencedBeanName.($isNullable?'|null':'').' $object |
|
| 190 | + * @param '.$referencedBeanName.($isNullable ? '|null' : '').' $object |
|
| 191 | 191 | */ |
| 192 | - public function '.$setterName.'('.($isNullable?'?':'').$referencedBeanName.' $object) : void |
|
| 192 | + public function '.$setterName.'('.($isNullable ? '?' : '').$referencedBeanName.' $object) : void |
|
| 193 | 193 | { |
| 194 | 194 | $this->setRef('.var_export($this->foreignKey->getName(), true).', $object, '.var_export($tableName, true).'); |
| 195 | 195 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getConstructorProperties() |
| 107 | 107 | { |
| 108 | - $constructorProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
| 108 | + $constructorProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
| 109 | 109 | return $property->isCompulsory(); |
| 110 | 110 | }); |
| 111 | 111 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | public function getPropertiesWithDefault() |
| 121 | 121 | { |
| 122 | 122 | $properties = $this->getPropertiesForTable($this->table); |
| 123 | - $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) { |
|
| 123 | + $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) { |
|
| 124 | 124 | return $property->hasDefault(); |
| 125 | 125 | }); |
| 126 | 126 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function getExposedProperties(): array |
| 136 | 136 | { |
| 137 | - $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
| 137 | + $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
| 138 | 138 | return $property->getTable()->getName() == $this->table->getName(); |
| 139 | 139 | }); |
| 140 | 140 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | foreach ($descriptorsByMethodName as $descriptorsForMethodName) { |
| 346 | - if (count($descriptorsForMethodName) > 1) { |
|
| 346 | + if (count($descriptorsForMethodName)>1) { |
|
| 347 | 347 | foreach ($descriptorsForMethodName as $descriptor) { |
| 348 | 348 | $descriptor->useAlternativeName(); |
| 349 | 349 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | $classes = $this->generateExtendsAndUseStatements($parentFk); |
| 440 | 440 | |
| 441 | - $uses = array_map(function ($className) use ($beannamespace) { |
|
| 441 | + $uses = array_map(function($className) use ($beannamespace) { |
|
| 442 | 442 | return 'use '.$beannamespace.'\\'.$className.";\n"; |
| 443 | 443 | }, $classes); |
| 444 | 444 | $use = implode('', $uses); |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | * |
| 740 | 740 | * @return string |
| 741 | 741 | */ |
| 742 | - public function getExtendedBeanClassName(): ?string |
|
| 742 | + public function getExtendedBeanClassName(): ? string |
|
| 743 | 743 | { |
| 744 | 744 | $parentFk = $this->schemaAnalyzer->getParentRelationship($this->table->getName()); |
| 745 | 745 | if ($parentFk !== null) { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * |
| 36 | 36 | * @return null|string |
| 37 | 37 | */ |
| 38 | - public function getExtendedBeanClassName(): ?string; |
|
| 38 | + public function getExtendedBeanClassName(): ? string; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Returns the DAO class name (without the namespace). |
@@ -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 |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | return $configuration->getProperty($property)->getValue(); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - private static function setInConfiguration(MoufManager $moufManager, string $tdbmInstanceName, string $property, ?string $value) |
|
| 138 | + private static function setInConfiguration(MoufManager $moufManager, string $tdbmInstanceName, string $property, ? string $value) |
|
| 139 | 139 | { |
| 140 | 140 | $configuration = self::getConfigurationDescriptor($moufManager, $tdbmInstanceName); |
| 141 | 141 | if ($configuration === null) { |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Mouf\Controllers\AbstractMoufInstanceController; |
| 7 | 7 | use Mouf\Database\TDBM\TDBMService; |
| 8 | 8 | use Mouf\Database\TDBM\Utils\PathFinder\PathFinder; |
| 9 | -use Mouf\Database\TDBM\Utils\TDBMDaoGenerator; |
|
| 10 | 9 | use Mouf\Html\HtmlElement\HtmlBlock; |
| 11 | 10 | use Mouf\MoufManager; |
| 12 | 11 | use Mouf\InstanceProxy; |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Remove all beans and daos from junction tables |
| 91 | 91 | $junctionTables = $this->configuration->getSchemaAnalyzer()->detectJunctionTables(true); |
| 92 | - $junctionTableNames = array_map(function (Table $table) { |
|
| 92 | + $junctionTableNames = array_map(function(Table $table) { |
|
| 93 | 93 | return $table->getName(); |
| 94 | 94 | }, $junctionTables); |
| 95 | 95 | |
| 96 | - $tableList = array_filter($tableList, function (Table $table) use ($junctionTableNames) { |
|
| 96 | + $tableList = array_filter($tableList, function(Table $table) use ($junctionTableNames) { |
|
| 97 | 97 | return !in_array($table->getName(), $junctionTableNames); |
| 98 | 98 | }); |
| 99 | 99 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $usedBeans[] = $beanClassName; |
| 252 | 252 | // Let's suppress duplicates in used beans (if any) |
| 253 | 253 | $usedBeans = array_flip(array_flip($usedBeans)); |
| 254 | - $useStatements = array_map(function ($usedBean) { |
|
| 254 | + $useStatements = array_map(function($usedBean) { |
|
| 255 | 255 | return "use $usedBean;\n"; |
| 256 | 256 | }, $usedBeans); |
| 257 | 257 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $pos = strpos($str, ' '); |
| 607 | 607 | } |
| 608 | 608 | $before = substr($str, 0, $pos); |
| 609 | - $after = substr($str, $pos + 1); |
|
| 609 | + $after = substr($str, $pos+1); |
|
| 610 | 610 | $str = $before.strtoupper(substr($after, 0, 1)).substr($after, 1); |
| 611 | 611 | } |
| 612 | 612 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $map = [ |
| 683 | 683 | Type::TARRAY => 'array', |
| 684 | 684 | Type::SIMPLE_ARRAY => 'array', |
| 685 | - 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
| 685 | + 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
| 686 | 686 | Type::JSON_ARRAY => 'array', |
| 687 | 687 | Type::BIGINT => 'string', |
| 688 | 688 | Type::BOOLEAN => 'bool', |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use Mouf\Database\TDBM\ConfigurationInterface; |
| 10 | 10 | use Mouf\Database\TDBM\TDBMException; |
| 11 | 11 | use Mouf\Database\TDBM\TDBMSchemaAnalyzer; |
| 12 | -use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
|
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * This class generates automatically DAOs and Beans for TDBM. |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Mouf\Actions\InstallUtils; |
| 7 | 7 | use Mouf\Console\ConsoleUtils; |
| 8 | 8 | use Mouf\Database\TDBM\Commands\GenerateCommand; |
| 9 | -use Mouf\Database\TDBM\Configuration; |
|
| 10 | 9 | use Mouf\Database\TDBM\MoufConfiguration; |
| 11 | 10 | use Mouf\Database\TDBM\Utils\DefaultNamingStrategy; |
| 12 | 11 | use Mouf\Database\TDBM\Utils\MoufDiListener; |
@@ -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) { |