@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | $output->writeln('<comment>[Mapping] Skipped mapping check.</comment>'); |
| 79 | 79 | } elseif ($errors = $validator->validateMapping()) { |
| 80 | 80 | foreach ($errors as $className => $errorMessages) { |
| 81 | - $output->writeln("<error>[Mapping] FAIL - The entity-class '" . $className . "' mapping is invalid:</error>"); |
|
| 81 | + $output->writeln("<error>[Mapping] FAIL - The entity-class '".$className."' mapping is invalid:</error>"); |
|
| 82 | 82 | |
| 83 | 83 | foreach ($errorMessages as $errorMessage) { |
| 84 | - $output->writeln('* ' . $errorMessage); |
|
| 84 | + $output->writeln('* '.$errorMessage); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $output->writeln(''); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | if ($input->getOption('skip-sync')) { |
| 96 | 96 | $output->writeln('<comment>[Database] SKIPPED - The database was not checked for synchronicity.</comment>'); |
| 97 | - } elseif (!$validator->schemaInSyncWithMetadata()) { |
|
| 97 | + } elseif ( ! $validator->schemaInSyncWithMetadata()) { |
|
| 98 | 98 | $output->writeln('<error>[Database] FAIL - The database schema is not in sync with the current mapping file.</error>'); |
| 99 | 99 | $exit += 2; |
| 100 | 100 | } else { |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | $entityManager = $this->getHelper('em')->getEntityManager(); |
| 59 | 59 | |
| 60 | 60 | $entityClassNames = $entityManager->getConfiguration() |
| 61 | - ->getMetadataDriverImpl() |
|
| 62 | - ->getAllClassNames(); |
|
| 61 | + ->getMetadataDriverImpl() |
|
| 62 | + ->getAllClassNames(); |
|
| 63 | 63 | |
| 64 | 64 | if (!$entityClassNames) { |
| 65 | 65 | throw new \Exception( |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | ->getMetadataDriverImpl() |
| 62 | 62 | ->getAllClassNames(); |
| 63 | 63 | |
| 64 | - if (!$entityClassNames) { |
|
| 64 | + if ( ! $entityClassNames) { |
|
| 65 | 65 | throw new \Exception( |
| 66 | 66 | 'You do not have any mapped Doctrine ORM entities according to the current configuration. '. |
| 67 | 67 | 'If you have entities or mapping files you should check your mapping configuration for errors.' |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | |
| 111 | 111 | if ($numRepositories) { |
| 112 | 112 | // Outputting information message |
| 113 | - $output->writeln(PHP_EOL . sprintf('Repository classes generated to "<info>%s</INFO>"', $destPath)); |
|
| 113 | + $output->writeln(PHP_EOL.sprintf('Repository classes generated to "<info>%s</INFO>"', $destPath)); |
|
| 114 | 114 | } else { |
| 115 | 115 | $output->writeln('No Repository classes were found to be processed.'); |
| 116 | 116 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } else { |
| 87 | 87 | $sqls = $schemaTool->getDropSchemaSQL($metadatas); |
| 88 | 88 | } |
| 89 | - $output->writeln(implode(';' . PHP_EOL, $sqls)); |
|
| 89 | + $output->writeln(implode(';'.PHP_EOL, $sqls)); |
|
| 90 | 90 | |
| 91 | 91 | return 0; |
| 92 | 92 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return 0; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $output->writeln('<comment>ATTENTION</comment>: This operation should not be executed in a production environment.' . PHP_EOL); |
|
| 108 | + $output->writeln('<comment>ATTENTION</comment>: This operation should not be executed in a production environment.'.PHP_EOL); |
|
| 109 | 109 | |
| 110 | 110 | if ($isFullDatabaseDrop) { |
| 111 | 111 | $sqls = $schemaTool->getDropDatabaseSQL(); |
@@ -71,9 +71,9 @@ |
||
| 71 | 71 | { |
| 72 | 72 | if ($input->getOption('dump-sql')) { |
| 73 | 73 | $sqls = $schemaTool->getCreateSchemaSql($metadatas); |
| 74 | - $output->writeln(implode(';' . PHP_EOL, $sqls) . ';'); |
|
| 74 | + $output->writeln(implode(';'.PHP_EOL, $sqls).';'); |
|
| 75 | 75 | } else { |
| 76 | - $output->writeln('ATTENTION: This operation should not be executed in a production environment.' . PHP_EOL); |
|
| 76 | + $output->writeln('ATTENTION: This operation should not be executed in a production environment.'.PHP_EOL); |
|
| 77 | 77 | |
| 78 | 78 | $output->writeln('Creating database schema...'); |
| 79 | 79 | $schemaTool->createSchema($metadatas); |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $force = true === $input->getOption('force'); |
| 123 | 123 | |
| 124 | 124 | if ($dumpSql) { |
| 125 | - $output->writeln(implode(';' . PHP_EOL, $sqls) . ';'); |
|
| 125 | + $output->writeln(implode(';'.PHP_EOL, $sqls).';'); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if ($force) { |
@@ -220,7 +220,7 @@ |
||
| 220 | 220 | $exporter->setMetadata($metadata); |
| 221 | 221 | $exporter->export(); |
| 222 | 222 | |
| 223 | - $output->writeln(PHP_EOL . sprintf( |
|
| 223 | + $output->writeln(PHP_EOL.sprintf( |
|
| 224 | 224 | 'Converting Doctrine 1.X schema to "<info>%s</info>" mapping type in "<info>%s</info>"', $toType, $destPath |
| 225 | 225 | )); |
| 226 | 226 | } else { |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | $em->getConnection()->connect(); |
| 72 | 72 | } |
| 73 | 73 | } catch (\Exception $e) { |
| 74 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 74 | + $output->writeln('<error>'.$e->getMessage().'</error>'); |
|
| 75 | 75 | |
| 76 | 76 | return 1; |
| 77 | 77 | } |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | |
| 1291 | 1291 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1292 | 1292 | $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
| 1293 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1293 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | return implode("\n", $lines); |
@@ -1318,7 +1318,7 @@ discard block |
||
| 1318 | 1318 | |
| 1319 | 1319 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1320 | 1320 | $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
| 1321 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1321 | + . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | return implode("\n", $lines); |
@@ -1381,14 +1381,14 @@ discard block |
||
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | $replacements = array( |
| 1384 | - '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1385 | - '<methodTypeHint>' => $methodTypeHint, |
|
| 1386 | - '<variableType>' => $variableType, |
|
| 1387 | - '<variableName>' => $variableName, |
|
| 1388 | - '<methodName>' => $methodName, |
|
| 1389 | - '<fieldName>' => $fieldName, |
|
| 1390 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
| 1391 | - '<entity>' => $this->getClassName($metadata) |
|
| 1384 | + '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1385 | + '<methodTypeHint>' => $methodTypeHint, |
|
| 1386 | + '<variableType>' => $variableType, |
|
| 1387 | + '<variableName>' => $variableName, |
|
| 1388 | + '<methodName>' => $methodName, |
|
| 1389 | + '<fieldName>' => $fieldName, |
|
| 1390 | + '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
| 1391 | + '<entity>' => $this->getClassName($metadata) |
|
| 1392 | 1392 | ); |
| 1393 | 1393 | |
| 1394 | 1394 | $method = str_replace( |
@@ -364,14 +364,14 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory) |
| 366 | 366 | { |
| 367 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
| 367 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
| 368 | 368 | $dir = dirname($path); |
| 369 | 369 | |
| 370 | 370 | if ( ! is_dir($dir)) { |
| 371 | 371 | mkdir($dir, 0775, true); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $this->isNew = !file_exists($path) || (file_exists($path) && $this->regenerateEntityIfExists); |
|
| 374 | + $this->isNew = ! file_exists($path) || (file_exists($path) && $this->regenerateEntityIfExists); |
|
| 375 | 375 | |
| 376 | 376 | if ( ! $this->isNew) { |
| 377 | 377 | $this->parseTokensInEntityFile(file_get_contents($path)); |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | if ($this->backupExisting && file_exists($path)) { |
| 383 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
| 384 | - if (!copy($path, $backupPath)) { |
|
| 383 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
| 384 | + if ( ! copy($path, $backupPath)) { |
|
| 385 | 385 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
| 386 | 386 | } |
| 387 | 387 | } |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $this->generateEntityBody($metadata) |
| 422 | 422 | ); |
| 423 | 423 | |
| 424 | - $code = str_replace($placeHolders, $replacements, static::$classTemplate) . "\n"; |
|
| 424 | + $code = str_replace($placeHolders, $replacements, static::$classTemplate)."\n"; |
|
| 425 | 425 | |
| 426 | 426 | return str_replace('<spaces>', $this->spaces, $code); |
| 427 | 427 | } |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 443 | 443 | $last = strrpos($currentCode, '}'); |
| 444 | 444 | |
| 445 | - return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}\n"; |
|
| 445 | + return substr($currentCode, 0, $last).$body.(strlen($body) > 0 ? "\n" : '')."}\n"; |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /** |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | public function setFieldVisibility($visibility) |
| 507 | 507 | { |
| 508 | 508 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 509 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 509 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | $this->fieldVisibility = $visibility; |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | protected function generateEntityNamespace(ClassMetadataInfo $metadata) |
| 605 | 605 | { |
| 606 | 606 | if ($this->hasNamespace($metadata)) { |
| 607 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
| 607 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | |
@@ -624,8 +624,8 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | protected function generateEntityClassName(ClassMetadataInfo $metadata) |
| 626 | 626 | { |
| 627 | - return 'class ' . $this->getClassName($metadata) . |
|
| 628 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
| 627 | + return 'class '.$this->getClassName($metadata). |
|
| 628 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -727,13 +727,13 @@ discard block |
||
| 727 | 727 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
| 728 | 728 | |
| 729 | 729 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
| 730 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
| 731 | - $paramVariable = '$' . $fieldName; |
|
| 730 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
| 731 | + $paramVariable = '$'.$fieldName; |
|
| 732 | 732 | |
| 733 | 733 | $paramTypes[] = $paramType; |
| 734 | 734 | $paramVariables[] = $paramVariable; |
| 735 | - $params[] = $paramType . ' ' . $paramVariable; |
|
| 736 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
| 735 | + $params[] = $paramType.' '.$paramVariable; |
|
| 736 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | foreach ($fieldMappings as $fieldMapping) { |
@@ -743,27 +743,27 @@ discard block |
||
| 743 | 743 | continue; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 747 | - $param = '$' . $fieldMapping['fieldName']; |
|
| 746 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 747 | + $param = '$'.$fieldMapping['fieldName']; |
|
| 748 | 748 | $paramVariables[] = $param; |
| 749 | 749 | |
| 750 | 750 | if ($fieldMapping['type'] === 'datetime') { |
| 751 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
| 751 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
| 752 | 752 | } |
| 753 | 753 | |
| 754 | - if (!empty($fieldMapping['nullable'])) { |
|
| 754 | + if ( ! empty($fieldMapping['nullable'])) { |
|
| 755 | 755 | $param .= ' = null'; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | $params[] = $param; |
| 759 | 759 | |
| 760 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
| 760 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
| 764 | 764 | $paramTags = array_map( |
| 765 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
| 766 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
| 765 | + function($type, $variable) use ($maxParamTypeLength) { |
|
| 766 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
| 767 | 767 | }, |
| 768 | 768 | $paramTypes, |
| 769 | 769 | $paramVariables |
@@ -771,8 +771,8 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | // Generate multi line constructor if the signature exceeds 120 characters. |
| 773 | 773 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
| 774 | - $delimiter = "\n" . $this->spaces; |
|
| 775 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
| 774 | + $delimiter = "\n".$this->spaces; |
|
| 775 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
| 776 | 776 | } else { |
| 777 | 777 | $params = implode(', ', $params); |
| 778 | 778 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $replacements = array( |
| 781 | 781 | '<paramTags>' => implode("\n * ", $paramTags), |
| 782 | 782 | '<params>' => $params, |
| 783 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
| 783 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
| 784 | 784 | ); |
| 785 | 785 | |
| 786 | 786 | $constructor = str_replace( |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | if ($inClass) { |
| 826 | 826 | $inClass = false; |
| 827 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 827 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 828 | 828 | $this->staticReflection[$lastSeenClass]['properties'] = array(); |
| 829 | 829 | $this->staticReflection[$lastSeenClass]['methods'] = array(); |
| 830 | 830 | } |
@@ -832,16 +832,16 @@ discard block |
||
| 832 | 832 | if ($token[0] == T_NAMESPACE) { |
| 833 | 833 | $lastSeenNamespace = ""; |
| 834 | 834 | $inNamespace = true; |
| 835 | - } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) { |
|
| 835 | + } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) { |
|
| 836 | 836 | $inClass = true; |
| 837 | 837 | } elseif ($token[0] == T_FUNCTION) { |
| 838 | - if ($tokens[$i+2][0] == T_STRING) { |
|
| 839 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 840 | - } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) { |
|
| 841 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 838 | + if ($tokens[$i + 2][0] == T_STRING) { |
|
| 839 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 840 | + } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) { |
|
| 841 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 842 | 842 | } |
| 843 | - } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i+2][0] != T_FUNCTION) { |
|
| 844 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 843 | + } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i + 2][0] != T_FUNCTION) { |
|
| 844 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | } |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | */ |
| 855 | 855 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
| 856 | 856 | { |
| 857 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 857 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 858 | 858 | // don't generate property if its already on the base class. |
| 859 | 859 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 860 | 860 | if ($reflClass->hasProperty($property)) { |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | */ |
| 884 | 884 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
| 885 | 885 | { |
| 886 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 886 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 887 | 887 | // don't generate method if its already on the base class. |
| 888 | 888 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 889 | 889 | |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | */ |
| 913 | 913 | protected function getTraits(ClassMetadataInfo $metadata) |
| 914 | 914 | { |
| 915 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 915 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 916 | 916 | return []; |
| 917 | 917 | } |
| 918 | 918 | |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | { |
| 965 | 965 | $refl = new \ReflectionClass($this->getClassToExtend()); |
| 966 | 966 | |
| 967 | - return '\\' . $refl->getName(); |
|
| 967 | + return '\\'.$refl->getName(); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | /** |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | { |
| 998 | 998 | $lines = array(); |
| 999 | 999 | $lines[] = '/**'; |
| 1000 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
| 1000 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
| 1001 | 1001 | |
| 1002 | 1002 | if ($this->generateAnnotations) { |
| 1003 | 1003 | $lines[] = ' *'; |
@@ -1012,12 +1012,12 @@ discard block |
||
| 1012 | 1012 | |
| 1013 | 1013 | foreach ($methods as $method) { |
| 1014 | 1014 | if ($code = $this->$method($metadata)) { |
| 1015 | - $lines[] = ' * ' . $code; |
|
| 1015 | + $lines[] = ' * '.$code; |
|
| 1016 | 1016 | } |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
| 1020 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
| 1020 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | } |
| 1023 | 1023 | |
@@ -1033,17 +1033,17 @@ discard block |
||
| 1033 | 1033 | */ |
| 1034 | 1034 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata) |
| 1035 | 1035 | { |
| 1036 | - $prefix = '@' . $this->annotationsPrefix; |
|
| 1036 | + $prefix = '@'.$this->annotationsPrefix; |
|
| 1037 | 1037 | |
| 1038 | 1038 | if ($metadata->isEmbeddedClass) { |
| 1039 | - return $prefix . 'Embeddable'; |
|
| 1039 | + return $prefix.'Embeddable'; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | $customRepository = $metadata->customRepositoryClassName |
| 1043 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
| 1043 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
| 1044 | 1044 | : ''; |
| 1045 | 1045 | |
| 1046 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
| 1046 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | /** |
@@ -1060,28 +1060,28 @@ discard block |
||
| 1060 | 1060 | $table = array(); |
| 1061 | 1061 | |
| 1062 | 1062 | if (isset($metadata->table['schema'])) { |
| 1063 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
| 1063 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | if (isset($metadata->table['name'])) { |
| 1067 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
| 1067 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
| 1071 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
| 1071 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
| 1075 | 1075 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
| 1076 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
| 1076 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
| 1080 | 1080 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
| 1081 | - $table[] = 'indexes={' . $constraints . '}'; |
|
| 1081 | + $table[] = 'indexes={'.$constraints.'}'; |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
| 1084 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | /** |
@@ -1096,9 +1096,9 @@ discard block |
||
| 1096 | 1096 | foreach ($constraints as $name => $constraint) { |
| 1097 | 1097 | $columns = array(); |
| 1098 | 1098 | foreach ($constraint['columns'] as $column) { |
| 1099 | - $columns[] = '"' . $column . '"'; |
|
| 1099 | + $columns[] = '"'.$column.'"'; |
|
| 1100 | 1100 | } |
| 1101 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
| 1101 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | 1104 | return implode(', ', $annotations); |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | protected function generateInheritanceAnnotation($metadata) |
| 1113 | 1113 | { |
| 1114 | 1114 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1115 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1115 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | 1118 | |
@@ -1125,11 +1125,11 @@ discard block |
||
| 1125 | 1125 | { |
| 1126 | 1126 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1127 | 1127 | $discrColumn = $metadata->discriminatorColumn; |
| 1128 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
| 1129 | - . '", type="' . $discrColumn['type'] |
|
| 1130 | - . '", length=' . $discrColumn['length']; |
|
| 1128 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
| 1129 | + . '", type="'.$discrColumn['type'] |
|
| 1130 | + . '", length='.$discrColumn['length']; |
|
| 1131 | 1131 | |
| 1132 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
| 1132 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
| 1133 | 1133 | } |
| 1134 | 1134 | } |
| 1135 | 1135 | |
@@ -1144,10 +1144,10 @@ discard block |
||
| 1144 | 1144 | $inheritanceClassMap = array(); |
| 1145 | 1145 | |
| 1146 | 1146 | foreach ($metadata->discriminatorMap as $type => $class) { |
| 1147 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
| 1147 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
| 1150 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
| 1151 | 1151 | } |
| 1152 | 1152 | } |
| 1153 | 1153 | |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | if (( ! isset($fieldMapping['id']) || |
| 1171 | 1171 | ! $fieldMapping['id'] || |
| 1172 | 1172 | $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE |
| 1173 | - ) && (! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1173 | + ) && ( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1174 | 1174 | ) { |
| 1175 | 1175 | if ($code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'])) { |
| 1176 | 1176 | $methods[] = $code; |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | foreach ($joinColumns as $joinColumn) { |
| 1245 | - if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
| 1245 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
| 1246 | 1246 | return false; |
| 1247 | 1247 | } |
| 1248 | 1248 | } |
@@ -1289,8 +1289,8 @@ discard block |
||
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1292 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
| 1293 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1292 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
| 1293 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | return implode("\n", $lines); |
@@ -1317,8 +1317,8 @@ discard block |
||
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1320 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
|
| 1321 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1320 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'] |
|
| 1321 | + . (isset($fieldMapping['options']['default']) ? ' = '.var_export($fieldMapping['options']['default'], true) : null).";\n"; |
|
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | return implode("\n", $lines); |
@@ -1339,7 +1339,7 @@ discard block |
||
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
| 1342 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
| 1342 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | return implode("\n", $lines); |
@@ -1354,9 +1354,9 @@ discard block |
||
| 1354 | 1354 | * |
| 1355 | 1355 | * @return string |
| 1356 | 1356 | */ |
| 1357 | - protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
|
| 1357 | + protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
|
| 1358 | 1358 | { |
| 1359 | - $methodName = $type . Inflector::classify($fieldName); |
|
| 1359 | + $methodName = $type.Inflector::classify($fieldName); |
|
| 1360 | 1360 | $variableName = Inflector::camelize($fieldName); |
| 1361 | 1361 | if (in_array($type, array("add", "remove"))) { |
| 1362 | 1362 | $methodName = Inflector::singularize($methodName); |
@@ -1376,18 +1376,18 @@ discard block |
||
| 1376 | 1376 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
| 1377 | 1377 | |
| 1378 | 1378 | if ($typeHint && ! isset($types[$typeHint])) { |
| 1379 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
| 1380 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
| 1379 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
| 1380 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | $replacements = array( |
| 1384 | - '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1384 | + '<description>' => ucfirst($type).' '.$variableName, |
|
| 1385 | 1385 | '<methodTypeHint>' => $methodTypeHint, |
| 1386 | 1386 | '<variableType>' => $variableType, |
| 1387 | 1387 | '<variableName>' => $variableName, |
| 1388 | 1388 | '<methodName>' => $methodName, |
| 1389 | 1389 | '<fieldName>' => $fieldName, |
| 1390 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
| 1390 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
| 1391 | 1391 | '<entity>' => $this->getClassName($metadata) |
| 1392 | 1392 | ); |
| 1393 | 1393 | |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
| 1416 | 1416 | |
| 1417 | 1417 | $replacements = array( |
| 1418 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
| 1418 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
| 1419 | 1419 | '<methodName>' => $methodName, |
| 1420 | 1420 | ); |
| 1421 | 1421 | |
@@ -1438,30 +1438,30 @@ discard block |
||
| 1438 | 1438 | $joinColumnAnnot = array(); |
| 1439 | 1439 | |
| 1440 | 1440 | if (isset($joinColumn['name'])) { |
| 1441 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
| 1441 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | if (isset($joinColumn['referencedColumnName'])) { |
| 1445 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
| 1445 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
| 1449 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1449 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | if (isset($joinColumn['nullable'])) { |
| 1453 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1453 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | 1456 | if (isset($joinColumn['onDelete'])) { |
| 1457 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
| 1457 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | 1460 | if (isset($joinColumn['columnDefinition'])) { |
| 1461 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
| 1461 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
| 1464 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
| 1465 | 1465 | } |
| 1466 | 1466 | |
| 1467 | 1467 | /** |
@@ -1473,22 +1473,22 @@ discard block |
||
| 1473 | 1473 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata) |
| 1474 | 1474 | { |
| 1475 | 1475 | $lines = array(); |
| 1476 | - $lines[] = $this->spaces . '/**'; |
|
| 1476 | + $lines[] = $this->spaces.'/**'; |
|
| 1477 | 1477 | |
| 1478 | 1478 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
| 1479 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1479 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1480 | 1480 | } else { |
| 1481 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1481 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | if ($this->generateAnnotations) { |
| 1485 | - $lines[] = $this->spaces . ' *'; |
|
| 1485 | + $lines[] = $this->spaces.' *'; |
|
| 1486 | 1486 | |
| 1487 | 1487 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
| 1488 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1488 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1489 | 1489 | |
| 1490 | 1490 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1491 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1491 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1492 | 1492 | } |
| 1493 | 1493 | } |
| 1494 | 1494 | |
@@ -1510,15 +1510,15 @@ discard block |
||
| 1510 | 1510 | $typeOptions = array(); |
| 1511 | 1511 | |
| 1512 | 1512 | if (isset($associationMapping['targetEntity'])) { |
| 1513 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
| 1513 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | if (isset($associationMapping['inversedBy'])) { |
| 1517 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
| 1517 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | 1520 | if (isset($associationMapping['mappedBy'])) { |
| 1521 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
| 1521 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | if ($associationMapping['cascade']) { |
@@ -1534,11 +1534,11 @@ discard block |
||
| 1534 | 1534 | $cascades = array('"all"'); |
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
| 1537 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
| 1538 | 1538 | } |
| 1539 | 1539 | |
| 1540 | 1540 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
| 1541 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1541 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | 1544 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1547,71 +1547,71 @@ discard block |
||
| 1547 | 1547 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
| 1548 | 1548 | ); |
| 1549 | 1549 | |
| 1550 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
| 1550 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
| 1553 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
| 1554 | 1554 | |
| 1555 | 1555 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
| 1556 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
| 1556 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
| 1557 | 1557 | |
| 1558 | 1558 | $joinColumnsLines = array(); |
| 1559 | 1559 | |
| 1560 | 1560 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
| 1561 | 1561 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
| 1562 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
| 1562 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
| 1563 | 1563 | } |
| 1564 | 1564 | } |
| 1565 | 1565 | |
| 1566 | 1566 | $lines[] = implode(",\n", $joinColumnsLines); |
| 1567 | - $lines[] = $this->spaces . ' * })'; |
|
| 1567 | + $lines[] = $this->spaces.' * })'; |
|
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
| 1571 | 1571 | $joinTable = array(); |
| 1572 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
| 1572 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
| 1573 | 1573 | |
| 1574 | 1574 | if (isset($associationMapping['joinTable']['schema'])) { |
| 1575 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
| 1575 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
| 1576 | 1576 | } |
| 1577 | 1577 | |
| 1578 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
| 1579 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
| 1578 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
| 1579 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
| 1580 | 1580 | |
| 1581 | 1581 | $joinColumnsLines = array(); |
| 1582 | 1582 | |
| 1583 | 1583 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
| 1584 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1584 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
| 1588 | - $lines[] = $this->spaces . ' * },'; |
|
| 1589 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
| 1587 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
| 1588 | + $lines[] = $this->spaces.' * },'; |
|
| 1589 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
| 1590 | 1590 | |
| 1591 | 1591 | $inverseJoinColumnsLines = array(); |
| 1592 | 1592 | |
| 1593 | 1593 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
| 1594 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1594 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1595 | 1595 | } |
| 1596 | 1596 | |
| 1597 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
| 1598 | - $lines[] = $this->spaces . ' * }'; |
|
| 1599 | - $lines[] = $this->spaces . ' * )'; |
|
| 1597 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
| 1598 | + $lines[] = $this->spaces.' * }'; |
|
| 1599 | + $lines[] = $this->spaces.' * )'; |
|
| 1600 | 1600 | } |
| 1601 | 1601 | |
| 1602 | 1602 | if (isset($associationMapping['orderBy'])) { |
| 1603 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
| 1603 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
| 1604 | 1604 | |
| 1605 | 1605 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
| 1606 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
| 1606 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | 1609 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
| 1610 | - $lines[] = $this->spaces . ' * })'; |
|
| 1610 | + $lines[] = $this->spaces.' * })'; |
|
| 1611 | 1611 | } |
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | - $lines[] = $this->spaces . ' */'; |
|
| 1614 | + $lines[] = $this->spaces.' */'; |
|
| 1615 | 1615 | |
| 1616 | 1616 | return implode("\n", $lines); |
| 1617 | 1617 | } |
@@ -1625,35 +1625,35 @@ discard block |
||
| 1625 | 1625 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata) |
| 1626 | 1626 | { |
| 1627 | 1627 | $lines = array(); |
| 1628 | - $lines[] = $this->spaces . '/**'; |
|
| 1629 | - $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']); |
|
| 1628 | + $lines[] = $this->spaces.'/**'; |
|
| 1629 | + $lines[] = $this->spaces.' * @var '.$this->getType($fieldMapping['type']); |
|
| 1630 | 1630 | |
| 1631 | 1631 | if ($this->generateAnnotations) { |
| 1632 | - $lines[] = $this->spaces . ' *'; |
|
| 1632 | + $lines[] = $this->spaces.' *'; |
|
| 1633 | 1633 | |
| 1634 | 1634 | $column = array(); |
| 1635 | 1635 | if (isset($fieldMapping['columnName'])) { |
| 1636 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
| 1636 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | if (isset($fieldMapping['type'])) { |
| 1640 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
| 1640 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | if (isset($fieldMapping['length'])) { |
| 1644 | - $column[] = 'length=' . $fieldMapping['length']; |
|
| 1644 | + $column[] = 'length='.$fieldMapping['length']; |
|
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | 1647 | if (isset($fieldMapping['precision'])) { |
| 1648 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
| 1648 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | 1651 | if (isset($fieldMapping['scale'])) { |
| 1652 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
| 1652 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | 1655 | if (isset($fieldMapping['nullable'])) { |
| 1656 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
| 1656 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | 1659 | $options = []; |
@@ -1667,47 +1667,47 @@ discard block |
||
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | 1669 | if (isset($fieldMapping['columnDefinition'])) { |
| 1670 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
| 1670 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | if (isset($fieldMapping['unique'])) { |
| 1674 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
| 1674 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
| 1677 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
| 1678 | 1678 | |
| 1679 | 1679 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
| 1680 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1680 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1681 | 1681 | |
| 1682 | 1682 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1683 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1683 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | if ($metadata->sequenceGeneratorDefinition) { |
| 1687 | 1687 | $sequenceGenerator = array(); |
| 1688 | 1688 | |
| 1689 | 1689 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
| 1690 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
| 1690 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
| 1694 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1694 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1695 | 1695 | } |
| 1696 | 1696 | |
| 1697 | 1697 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
| 1698 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1698 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
| 1701 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
| 1702 | 1702 | } |
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | 1705 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
| 1706 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
| 1706 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
| 1707 | 1707 | } |
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | - $lines[] = $this->spaces . ' */'; |
|
| 1710 | + $lines[] = $this->spaces.' */'; |
|
| 1711 | 1711 | |
| 1712 | 1712 | return implode("\n", $lines); |
| 1713 | 1713 | } |
@@ -1720,23 +1720,23 @@ discard block |
||
| 1720 | 1720 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
| 1721 | 1721 | { |
| 1722 | 1722 | $lines = array(); |
| 1723 | - $lines[] = $this->spaces . '/**'; |
|
| 1724 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
| 1723 | + $lines[] = $this->spaces.'/**'; |
|
| 1724 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
| 1725 | 1725 | |
| 1726 | 1726 | if ($this->generateAnnotations) { |
| 1727 | - $lines[] = $this->spaces . ' *'; |
|
| 1727 | + $lines[] = $this->spaces.' *'; |
|
| 1728 | 1728 | |
| 1729 | - $embedded = array('class="' . $embeddedClass['class'] . '"'); |
|
| 1729 | + $embedded = array('class="'.$embeddedClass['class'].'"'); |
|
| 1730 | 1730 | |
| 1731 | 1731 | if (isset($fieldMapping['columnPrefix'])) { |
| 1732 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
| 1732 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | - $lines[] = $this->spaces . ' * @' . |
|
| 1736 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
| 1735 | + $lines[] = $this->spaces.' * @'. |
|
| 1736 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
| 1737 | 1737 | } |
| 1738 | 1738 | |
| 1739 | - $lines[] = $this->spaces . ' */'; |
|
| 1739 | + $lines[] = $this->spaces.' */'; |
|
| 1740 | 1740 | |
| 1741 | 1741 | return implode("\n", $lines); |
| 1742 | 1742 | } |
@@ -1753,7 +1753,7 @@ discard block |
||
| 1753 | 1753 | |
| 1754 | 1754 | foreach ($lines as $key => $value) { |
| 1755 | 1755 | if ( ! empty($value)) { |
| 1756 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1756 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1757 | 1757 | } |
| 1758 | 1758 | } |
| 1759 | 1759 | |
@@ -1821,9 +1821,9 @@ discard block |
||
| 1821 | 1821 | |
| 1822 | 1822 | foreach ($options as $name => $option) { |
| 1823 | 1823 | if (is_array($option)) { |
| 1824 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
| 1824 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
| 1825 | 1825 | } else { |
| 1826 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
| 1826 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
| 1827 | 1827 | } |
| 1828 | 1828 | } |
| 1829 | 1829 | |
@@ -1524,11 +1524,21 @@ |
||
| 1524 | 1524 | if ($associationMapping['cascade']) { |
| 1525 | 1525 | $cascades = array(); |
| 1526 | 1526 | |
| 1527 | - if ($associationMapping['isCascadePersist']) $cascades[] = '"persist"'; |
|
| 1528 | - if ($associationMapping['isCascadeRemove']) $cascades[] = '"remove"'; |
|
| 1529 | - if ($associationMapping['isCascadeDetach']) $cascades[] = '"detach"'; |
|
| 1530 | - if ($associationMapping['isCascadeMerge']) $cascades[] = '"merge"'; |
|
| 1531 | - if ($associationMapping['isCascadeRefresh']) $cascades[] = '"refresh"'; |
|
| 1527 | + if ($associationMapping['isCascadePersist']) { |
|
| 1528 | + $cascades[] = '"persist"'; |
|
| 1529 | + } |
|
| 1530 | + if ($associationMapping['isCascadeRemove']) { |
|
| 1531 | + $cascades[] = '"remove"'; |
|
| 1532 | + } |
|
| 1533 | + if ($associationMapping['isCascadeDetach']) { |
|
| 1534 | + $cascades[] = '"detach"'; |
|
| 1535 | + } |
|
| 1536 | + if ($associationMapping['isCascadeMerge']) { |
|
| 1537 | + $cascades[] = '"merge"'; |
|
| 1538 | + } |
|
| 1539 | + if ($associationMapping['isCascadeRefresh']) { |
|
| 1540 | + $cascades[] = '"refresh"'; |
|
| 1541 | + } |
|
| 1532 | 1542 | |
| 1533 | 1543 | if (count($cascades) === 5) { |
| 1534 | 1544 | $cascades = array('"all"'); |