@@ -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.' |
@@ -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) { |
@@ -126,9 +126,9 @@ |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if ($force) { |
| 129 | - if ($dumpSql) { |
|
| 129 | + if ($dumpSql) { |
|
| 130 | 130 | $output->writeln(''); |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | $output->writeln('Updating database schema...'); |
| 133 | 133 | $schemaTool->updateSchema($metadatas, $saveMode); |
| 134 | 134 | |
@@ -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( |
@@ -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"'); |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory) |
| 362 | 362 | { |
| 363 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
| 363 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
| 364 | 364 | $dir = dirname($path); |
| 365 | 365 | |
| 366 | 366 | if ( ! is_dir($dir)) { |
| 367 | 367 | mkdir($dir, 0775, true); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - $this->isNew = !file_exists($path) || (file_exists($path) && $this->regenerateEntityIfExists); |
|
| 370 | + $this->isNew = ! file_exists($path) || (file_exists($path) && $this->regenerateEntityIfExists); |
|
| 371 | 371 | |
| 372 | 372 | if ( ! $this->isNew) { |
| 373 | 373 | $this->parseTokensInEntityFile(file_get_contents($path)); |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | if ($this->backupExisting && file_exists($path)) { |
| 379 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
| 380 | - if (!copy($path, $backupPath)) { |
|
| 379 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
| 380 | + if ( ! copy($path, $backupPath)) { |
|
| 381 | 381 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
| 382 | 382 | } |
| 383 | 383 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $this->generateEntityBody($metadata) |
| 418 | 418 | ); |
| 419 | 419 | |
| 420 | - $code = str_replace($placeHolders, $replacements, static::$classTemplate) . "\n"; |
|
| 420 | + $code = str_replace($placeHolders, $replacements, static::$classTemplate)."\n"; |
|
| 421 | 421 | |
| 422 | 422 | return str_replace('<spaces>', $this->spaces, $code); |
| 423 | 423 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 439 | 439 | $last = strrpos($currentCode, '}'); |
| 440 | 440 | |
| 441 | - return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}\n"; |
|
| 441 | + return substr($currentCode, 0, $last).$body.(strlen($body) > 0 ? "\n" : '')."}\n"; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | public function setFieldVisibility($visibility) |
| 503 | 503 | { |
| 504 | 504 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 505 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 505 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | $this->fieldVisibility = $visibility; |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | protected function generateEntityNamespace(ClassMetadataInfo $metadata) |
| 601 | 601 | { |
| 602 | 602 | if ($this->hasNamespace($metadata)) { |
| 603 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
| 603 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | |
@@ -620,8 +620,8 @@ discard block |
||
| 620 | 620 | */ |
| 621 | 621 | protected function generateEntityClassName(ClassMetadataInfo $metadata) |
| 622 | 622 | { |
| 623 | - return 'class ' . $this->getClassName($metadata) . |
|
| 624 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
| 623 | + return 'class '.$this->getClassName($metadata). |
|
| 624 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | /** |
@@ -723,13 +723,13 @@ discard block |
||
| 723 | 723 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
| 724 | 724 | |
| 725 | 725 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
| 726 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
| 727 | - $paramVariable = '$' . $fieldName; |
|
| 726 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
| 727 | + $paramVariable = '$'.$fieldName; |
|
| 728 | 728 | |
| 729 | 729 | $paramTypes[] = $paramType; |
| 730 | 730 | $paramVariables[] = $paramVariable; |
| 731 | - $params[] = $paramType . ' ' . $paramVariable; |
|
| 732 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
| 731 | + $params[] = $paramType.' '.$paramVariable; |
|
| 732 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | foreach ($fieldMappings as $fieldMapping) { |
@@ -739,27 +739,27 @@ discard block |
||
| 739 | 739 | continue; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 743 | - $param = '$' . $fieldMapping['fieldName']; |
|
| 742 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 743 | + $param = '$'.$fieldMapping['fieldName']; |
|
| 744 | 744 | $paramVariables[] = $param; |
| 745 | 745 | |
| 746 | 746 | if ($fieldMapping['type'] === 'datetime') { |
| 747 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
| 747 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - if (!empty($fieldMapping['nullable'])) { |
|
| 750 | + if ( ! empty($fieldMapping['nullable'])) { |
|
| 751 | 751 | $param .= ' = null'; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | $params[] = $param; |
| 755 | 755 | |
| 756 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
| 756 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
| 760 | 760 | $paramTags = array_map( |
| 761 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
| 762 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
| 761 | + function($type, $variable) use ($maxParamTypeLength) { |
|
| 762 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
| 763 | 763 | }, |
| 764 | 764 | $paramTypes, |
| 765 | 765 | $paramVariables |
@@ -767,8 +767,8 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | // Generate multi line constructor if the signature exceeds 120 characters. |
| 769 | 769 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
| 770 | - $delimiter = "\n" . $this->spaces; |
|
| 771 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
| 770 | + $delimiter = "\n".$this->spaces; |
|
| 771 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
| 772 | 772 | } else { |
| 773 | 773 | $params = implode(', ', $params); |
| 774 | 774 | } |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | $replacements = array( |
| 777 | 777 | '<paramTags>' => implode("\n * ", $paramTags), |
| 778 | 778 | '<params>' => $params, |
| 779 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
| 779 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
| 780 | 780 | ); |
| 781 | 781 | |
| 782 | 782 | $constructor = str_replace( |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | |
| 821 | 821 | if ($inClass) { |
| 822 | 822 | $inClass = false; |
| 823 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 823 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 824 | 824 | $this->staticReflection[$lastSeenClass]['properties'] = array(); |
| 825 | 825 | $this->staticReflection[$lastSeenClass]['methods'] = array(); |
| 826 | 826 | } |
@@ -828,16 +828,16 @@ discard block |
||
| 828 | 828 | if ($token[0] == T_NAMESPACE) { |
| 829 | 829 | $lastSeenNamespace = ""; |
| 830 | 830 | $inNamespace = true; |
| 831 | - } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) { |
|
| 831 | + } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) { |
|
| 832 | 832 | $inClass = true; |
| 833 | 833 | } elseif ($token[0] == T_FUNCTION) { |
| 834 | - if ($tokens[$i+2][0] == T_STRING) { |
|
| 835 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 836 | - } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) { |
|
| 837 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 834 | + if ($tokens[$i + 2][0] == T_STRING) { |
|
| 835 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 836 | + } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) { |
|
| 837 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 838 | 838 | } |
| 839 | - } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i+2][0] != T_FUNCTION) { |
|
| 840 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 839 | + } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED)) && $tokens[$i + 2][0] != T_FUNCTION) { |
|
| 840 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 841 | 841 | } |
| 842 | 842 | } |
| 843 | 843 | } |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | */ |
| 851 | 851 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
| 852 | 852 | { |
| 853 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 853 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 854 | 854 | // don't generate property if its already on the base class. |
| 855 | 855 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 856 | 856 | if ($reflClass->hasProperty($property)) { |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | */ |
| 880 | 880 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
| 881 | 881 | { |
| 882 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 882 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 883 | 883 | // don't generate method if its already on the base class. |
| 884 | 884 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 885 | 885 | |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | protected function getTraits(ClassMetadataInfo $metadata) |
| 910 | 910 | { |
| 911 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 911 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 912 | 912 | return []; |
| 913 | 913 | } |
| 914 | 914 | |
@@ -960,7 +960,7 @@ discard block |
||
| 960 | 960 | { |
| 961 | 961 | $refl = new \ReflectionClass($this->getClassToExtend()); |
| 962 | 962 | |
| 963 | - return '\\' . $refl->getName(); |
|
| 963 | + return '\\'.$refl->getName(); |
|
| 964 | 964 | } |
| 965 | 965 | |
| 966 | 966 | /** |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | { |
| 994 | 994 | $lines = array(); |
| 995 | 995 | $lines[] = '/**'; |
| 996 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
| 996 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
| 997 | 997 | |
| 998 | 998 | if ($this->generateAnnotations) { |
| 999 | 999 | $lines[] = ' *'; |
@@ -1008,12 +1008,12 @@ discard block |
||
| 1008 | 1008 | |
| 1009 | 1009 | foreach ($methods as $method) { |
| 1010 | 1010 | if ($code = $this->$method($metadata)) { |
| 1011 | - $lines[] = ' * ' . $code; |
|
| 1011 | + $lines[] = ' * '.$code; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
| 1016 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
| 1016 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | } |
| 1019 | 1019 | |
@@ -1029,17 +1029,17 @@ discard block |
||
| 1029 | 1029 | */ |
| 1030 | 1030 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata) |
| 1031 | 1031 | { |
| 1032 | - $prefix = '@' . $this->annotationsPrefix; |
|
| 1032 | + $prefix = '@'.$this->annotationsPrefix; |
|
| 1033 | 1033 | |
| 1034 | 1034 | if ($metadata->isEmbeddedClass) { |
| 1035 | - return $prefix . 'Embeddable'; |
|
| 1035 | + return $prefix.'Embeddable'; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | $customRepository = $metadata->customRepositoryClassName |
| 1039 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
| 1039 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
| 1040 | 1040 | : ''; |
| 1041 | 1041 | |
| 1042 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
| 1042 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | /** |
@@ -1056,28 +1056,28 @@ discard block |
||
| 1056 | 1056 | $table = array(); |
| 1057 | 1057 | |
| 1058 | 1058 | if (isset($metadata->table['schema'])) { |
| 1059 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
| 1059 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | if (isset($metadata->table['name'])) { |
| 1063 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
| 1063 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
| 1067 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
| 1067 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
| 1071 | 1071 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
| 1072 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
| 1072 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
| 1076 | 1076 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
| 1077 | - $table[] = 'indexes={' . $constraints . '}'; |
|
| 1077 | + $table[] = 'indexes={'.$constraints.'}'; |
|
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
| 1080 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | /** |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | foreach ($constraints as $name => $constraint) { |
| 1093 | 1093 | $columns = array(); |
| 1094 | 1094 | foreach ($constraint['columns'] as $column) { |
| 1095 | - $columns[] = '"' . $column . '"'; |
|
| 1095 | + $columns[] = '"'.$column.'"'; |
|
| 1096 | 1096 | } |
| 1097 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
| 1097 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
| 1098 | 1098 | } |
| 1099 | 1099 | return implode(', ', $annotations); |
| 1100 | 1100 | } |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | protected function generateInheritanceAnnotation($metadata) |
| 1108 | 1108 | { |
| 1109 | 1109 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1110 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1110 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | 1113 | |
@@ -1120,11 +1120,11 @@ discard block |
||
| 1120 | 1120 | { |
| 1121 | 1121 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
| 1122 | 1122 | $discrColumn = $metadata->discriminatorColumn; |
| 1123 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
| 1124 | - . '", type="' . $discrColumn['type'] |
|
| 1125 | - . '", length=' . $discrColumn['length']; |
|
| 1123 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
| 1124 | + . '", type="'.$discrColumn['type'] |
|
| 1125 | + . '", length='.$discrColumn['length']; |
|
| 1126 | 1126 | |
| 1127 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
| 1127 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
| 1128 | 1128 | } |
| 1129 | 1129 | } |
| 1130 | 1130 | |
@@ -1139,10 +1139,10 @@ discard block |
||
| 1139 | 1139 | $inheritanceClassMap = array(); |
| 1140 | 1140 | |
| 1141 | 1141 | foreach ($metadata->discriminatorMap as $type => $class) { |
| 1142 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
| 1142 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
| 1145 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
| 1146 | 1146 | } |
| 1147 | 1147 | } |
| 1148 | 1148 | |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | if (( ! isset($fieldMapping['id']) || |
| 1166 | 1166 | ! $fieldMapping['id'] || |
| 1167 | 1167 | $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE |
| 1168 | - ) && (! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1168 | + ) && ( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1169 | 1169 | ) { |
| 1170 | 1170 | if ($code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'])) { |
| 1171 | 1171 | $methods[] = $code; |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | foreach ($joinColumns as $joinColumn) { |
| 1240 | - if(isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
| 1240 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
| 1241 | 1241 | return false; |
| 1242 | 1242 | } |
| 1243 | 1243 | } |
@@ -1284,8 +1284,8 @@ discard block |
||
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | 1286 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1287 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
| 1288 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1287 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
| 1288 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | return implode("\n", $lines); |
@@ -1312,8 +1312,8 @@ discard block |
||
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | 1314 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1315 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
|
| 1316 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
| 1315 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'] |
|
| 1316 | + . (isset($fieldMapping['options']['default']) ? ' = '.var_export($fieldMapping['options']['default'], true) : null).";\n"; |
|
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | return implode("\n", $lines); |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | 1336 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
| 1337 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
| 1337 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | return implode("\n", $lines); |
@@ -1349,9 +1349,9 @@ discard block |
||
| 1349 | 1349 | * |
| 1350 | 1350 | * @return string |
| 1351 | 1351 | */ |
| 1352 | - protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
|
| 1352 | + protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
|
| 1353 | 1353 | { |
| 1354 | - $methodName = $type . Inflector::classify($fieldName); |
|
| 1354 | + $methodName = $type.Inflector::classify($fieldName); |
|
| 1355 | 1355 | $variableName = Inflector::camelize($fieldName); |
| 1356 | 1356 | if (in_array($type, array("add", "remove"))) { |
| 1357 | 1357 | $methodName = Inflector::singularize($methodName); |
@@ -1371,18 +1371,18 @@ discard block |
||
| 1371 | 1371 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
| 1372 | 1372 | |
| 1373 | 1373 | if ($typeHint && ! isset($types[$typeHint])) { |
| 1374 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
| 1375 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
| 1374 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
| 1375 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | 1378 | $replacements = array( |
| 1379 | - '<description>' => ucfirst($type) . ' ' . $variableName, |
|
| 1379 | + '<description>' => ucfirst($type).' '.$variableName, |
|
| 1380 | 1380 | '<methodTypeHint>' => $methodTypeHint, |
| 1381 | 1381 | '<variableType>' => $variableType, |
| 1382 | 1382 | '<variableName>' => $variableName, |
| 1383 | 1383 | '<methodName>' => $methodName, |
| 1384 | 1384 | '<fieldName>' => $fieldName, |
| 1385 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
| 1385 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
| 1386 | 1386 | '<entity>' => $this->getClassName($metadata) |
| 1387 | 1387 | ); |
| 1388 | 1388 | |
@@ -1410,7 +1410,7 @@ discard block |
||
| 1410 | 1410 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
| 1411 | 1411 | |
| 1412 | 1412 | $replacements = array( |
| 1413 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
| 1413 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
| 1414 | 1414 | '<methodName>' => $methodName, |
| 1415 | 1415 | ); |
| 1416 | 1416 | |
@@ -1433,30 +1433,30 @@ discard block |
||
| 1433 | 1433 | $joinColumnAnnot = array(); |
| 1434 | 1434 | |
| 1435 | 1435 | if (isset($joinColumn['name'])) { |
| 1436 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
| 1436 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | if (isset($joinColumn['referencedColumnName'])) { |
| 1440 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
| 1440 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
| 1444 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1444 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | if (isset($joinColumn['nullable'])) { |
| 1448 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1448 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | 1451 | if (isset($joinColumn['onDelete'])) { |
| 1452 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
| 1452 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | 1455 | if (isset($joinColumn['columnDefinition'])) { |
| 1456 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
| 1456 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
| 1459 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | /** |
@@ -1468,22 +1468,22 @@ discard block |
||
| 1468 | 1468 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata) |
| 1469 | 1469 | { |
| 1470 | 1470 | $lines = array(); |
| 1471 | - $lines[] = $this->spaces . '/**'; |
|
| 1471 | + $lines[] = $this->spaces.'/**'; |
|
| 1472 | 1472 | |
| 1473 | 1473 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
| 1474 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1474 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1475 | 1475 | } else { |
| 1476 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1476 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | 1479 | if ($this->generateAnnotations) { |
| 1480 | - $lines[] = $this->spaces . ' *'; |
|
| 1480 | + $lines[] = $this->spaces.' *'; |
|
| 1481 | 1481 | |
| 1482 | 1482 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
| 1483 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1483 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1484 | 1484 | |
| 1485 | 1485 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1486 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1486 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1487 | 1487 | } |
| 1488 | 1488 | } |
| 1489 | 1489 | |
@@ -1505,15 +1505,15 @@ discard block |
||
| 1505 | 1505 | $typeOptions = array(); |
| 1506 | 1506 | |
| 1507 | 1507 | if (isset($associationMapping['targetEntity'])) { |
| 1508 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
| 1508 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | if (isset($associationMapping['inversedBy'])) { |
| 1512 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
| 1512 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | 1515 | if (isset($associationMapping['mappedBy'])) { |
| 1516 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
| 1516 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | if ($associationMapping['cascade']) { |
@@ -1529,11 +1529,11 @@ discard block |
||
| 1529 | 1529 | $cascades = array('"all"'); |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
| 1532 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | 1535 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
| 1536 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1536 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1542,71 +1542,71 @@ discard block |
||
| 1542 | 1542 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
| 1543 | 1543 | ); |
| 1544 | 1544 | |
| 1545 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
| 1545 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
| 1548 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
| 1549 | 1549 | |
| 1550 | 1550 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
| 1551 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
| 1551 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
| 1552 | 1552 | |
| 1553 | 1553 | $joinColumnsLines = array(); |
| 1554 | 1554 | |
| 1555 | 1555 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
| 1556 | 1556 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
| 1557 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
| 1557 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
| 1558 | 1558 | } |
| 1559 | 1559 | } |
| 1560 | 1560 | |
| 1561 | 1561 | $lines[] = implode(",\n", $joinColumnsLines); |
| 1562 | - $lines[] = $this->spaces . ' * })'; |
|
| 1562 | + $lines[] = $this->spaces.' * })'; |
|
| 1563 | 1563 | } |
| 1564 | 1564 | |
| 1565 | 1565 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
| 1566 | 1566 | $joinTable = array(); |
| 1567 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
| 1567 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
| 1568 | 1568 | |
| 1569 | 1569 | if (isset($associationMapping['joinTable']['schema'])) { |
| 1570 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
| 1570 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
| 1571 | 1571 | } |
| 1572 | 1572 | |
| 1573 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
| 1574 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
| 1573 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
| 1574 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
| 1575 | 1575 | |
| 1576 | 1576 | $joinColumnsLines = array(); |
| 1577 | 1577 | |
| 1578 | 1578 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
| 1579 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1579 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
| 1583 | - $lines[] = $this->spaces . ' * },'; |
|
| 1584 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
| 1582 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
| 1583 | + $lines[] = $this->spaces.' * },'; |
|
| 1584 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
| 1585 | 1585 | |
| 1586 | 1586 | $inverseJoinColumnsLines = array(); |
| 1587 | 1587 | |
| 1588 | 1588 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
| 1589 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1589 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1590 | 1590 | } |
| 1591 | 1591 | |
| 1592 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
| 1593 | - $lines[] = $this->spaces . ' * }'; |
|
| 1594 | - $lines[] = $this->spaces . ' * )'; |
|
| 1592 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
| 1593 | + $lines[] = $this->spaces.' * }'; |
|
| 1594 | + $lines[] = $this->spaces.' * )'; |
|
| 1595 | 1595 | } |
| 1596 | 1596 | |
| 1597 | 1597 | if (isset($associationMapping['orderBy'])) { |
| 1598 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
| 1598 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
| 1599 | 1599 | |
| 1600 | 1600 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
| 1601 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
| 1601 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | 1604 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
| 1605 | - $lines[] = $this->spaces . ' * })'; |
|
| 1605 | + $lines[] = $this->spaces.' * })'; |
|
| 1606 | 1606 | } |
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | - $lines[] = $this->spaces . ' */'; |
|
| 1609 | + $lines[] = $this->spaces.' */'; |
|
| 1610 | 1610 | |
| 1611 | 1611 | return implode("\n", $lines); |
| 1612 | 1612 | } |
@@ -1620,35 +1620,35 @@ discard block |
||
| 1620 | 1620 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata) |
| 1621 | 1621 | { |
| 1622 | 1622 | $lines = array(); |
| 1623 | - $lines[] = $this->spaces . '/**'; |
|
| 1624 | - $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']); |
|
| 1623 | + $lines[] = $this->spaces.'/**'; |
|
| 1624 | + $lines[] = $this->spaces.' * @var '.$this->getType($fieldMapping['type']); |
|
| 1625 | 1625 | |
| 1626 | 1626 | if ($this->generateAnnotations) { |
| 1627 | - $lines[] = $this->spaces . ' *'; |
|
| 1627 | + $lines[] = $this->spaces.' *'; |
|
| 1628 | 1628 | |
| 1629 | 1629 | $column = array(); |
| 1630 | 1630 | if (isset($fieldMapping['columnName'])) { |
| 1631 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
| 1631 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | if (isset($fieldMapping['type'])) { |
| 1635 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
| 1635 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | if (isset($fieldMapping['length'])) { |
| 1639 | - $column[] = 'length=' . $fieldMapping['length']; |
|
| 1639 | + $column[] = 'length='.$fieldMapping['length']; |
|
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | if (isset($fieldMapping['precision'])) { |
| 1643 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
| 1643 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
| 1644 | 1644 | } |
| 1645 | 1645 | |
| 1646 | 1646 | if (isset($fieldMapping['scale'])) { |
| 1647 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
| 1647 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | if (isset($fieldMapping['nullable'])) { |
| 1651 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
| 1651 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
| 1652 | 1652 | } |
| 1653 | 1653 | |
| 1654 | 1654 | if (isset($fieldMapping['unsigned']) && $fieldMapping['unsigned']) { |
@@ -1656,47 +1656,47 @@ discard block |
||
| 1656 | 1656 | } |
| 1657 | 1657 | |
| 1658 | 1658 | if (isset($fieldMapping['columnDefinition'])) { |
| 1659 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
| 1659 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | 1662 | if (isset($fieldMapping['unique'])) { |
| 1663 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
| 1663 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
| 1666 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
| 1667 | 1667 | |
| 1668 | 1668 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
| 1669 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1669 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1670 | 1670 | |
| 1671 | 1671 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1672 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1672 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1673 | 1673 | } |
| 1674 | 1674 | |
| 1675 | 1675 | if ($metadata->sequenceGeneratorDefinition) { |
| 1676 | 1676 | $sequenceGenerator = array(); |
| 1677 | 1677 | |
| 1678 | 1678 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
| 1679 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
| 1679 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | 1682 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
| 1683 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1683 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
| 1687 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1687 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
| 1690 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
| 1691 | 1691 | } |
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
| 1695 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
| 1695 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
| 1696 | 1696 | } |
| 1697 | 1697 | } |
| 1698 | 1698 | |
| 1699 | - $lines[] = $this->spaces . ' */'; |
|
| 1699 | + $lines[] = $this->spaces.' */'; |
|
| 1700 | 1700 | |
| 1701 | 1701 | return implode("\n", $lines); |
| 1702 | 1702 | } |
@@ -1709,23 +1709,23 @@ discard block |
||
| 1709 | 1709 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
| 1710 | 1710 | { |
| 1711 | 1711 | $lines = array(); |
| 1712 | - $lines[] = $this->spaces . '/**'; |
|
| 1713 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
| 1712 | + $lines[] = $this->spaces.'/**'; |
|
| 1713 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
| 1714 | 1714 | |
| 1715 | 1715 | if ($this->generateAnnotations) { |
| 1716 | - $lines[] = $this->spaces . ' *'; |
|
| 1716 | + $lines[] = $this->spaces.' *'; |
|
| 1717 | 1717 | |
| 1718 | - $embedded = array('class="' . $embeddedClass['class'] . '"'); |
|
| 1718 | + $embedded = array('class="'.$embeddedClass['class'].'"'); |
|
| 1719 | 1719 | |
| 1720 | 1720 | if (isset($fieldMapping['columnPrefix'])) { |
| 1721 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
| 1721 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | - $lines[] = $this->spaces . ' * @' . |
|
| 1725 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
| 1724 | + $lines[] = $this->spaces.' * @'. |
|
| 1725 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | - $lines[] = $this->spaces . ' */'; |
|
| 1728 | + $lines[] = $this->spaces.' */'; |
|
| 1729 | 1729 | |
| 1730 | 1730 | return implode("\n", $lines); |
| 1731 | 1731 | } |
@@ -1742,7 +1742,7 @@ discard block |
||
| 1742 | 1742 | |
| 1743 | 1743 | foreach ($lines as $key => $value) { |
| 1744 | 1744 | if ( ! empty($value)) { |
| 1745 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1745 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1746 | 1746 | } |
| 1747 | 1747 | } |
| 1748 | 1748 | |
@@ -1806,11 +1806,11 @@ discard block |
||
| 1806 | 1806 | { |
| 1807 | 1807 | $optionsStr = array(); |
| 1808 | 1808 | |
| 1809 | - foreach($options as $name => $option) { |
|
| 1809 | + foreach ($options as $name => $option) { |
|
| 1810 | 1810 | if (is_array($option)) { |
| 1811 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
| 1811 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
| 1812 | 1812 | } else { |
| 1813 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
| 1813 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
| 1814 | 1814 | } |
| 1815 | 1815 | } |
| 1816 | 1816 | |
@@ -242,17 +242,17 @@ |
||
| 242 | 242 | public function getUnitOfWork(); |
| 243 | 243 | |
| 244 | 244 | /** |
| 245 | - * Gets a hydrator for the given hydration mode. |
|
| 246 | - * |
|
| 247 | - * This method caches the hydrator instances which is used for all queries that don't |
|
| 248 | - * selectively iterate over the result. |
|
| 249 | - * |
|
| 250 | - * @deprecated |
|
| 251 | - * |
|
| 252 | - * @param int $hydrationMode |
|
| 253 | - * |
|
| 254 | - * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator |
|
| 255 | - */ |
|
| 245 | + * Gets a hydrator for the given hydration mode. |
|
| 246 | + * |
|
| 247 | + * This method caches the hydrator instances which is used for all queries that don't |
|
| 248 | + * selectively iterate over the result. |
|
| 249 | + * |
|
| 250 | + * @deprecated |
|
| 251 | + * |
|
| 252 | + * @param int $hydrationMode |
|
| 253 | + * |
|
| 254 | + * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator |
|
| 255 | + */ |
|
| 256 | 256 | public function getHydrator($hydrationMode); |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | // It's a joined result |
| 109 | 109 | |
| 110 | 110 | $parent = $this->_rsm->parentAliasMap[$dqlAlias]; |
| 111 | - $path = $parent . '.' . $dqlAlias; |
|
| 111 | + $path = $parent.'.'.$dqlAlias; |
|
| 112 | 112 | |
| 113 | 113 | // missing parent data, skipping as RIGHT JOIN hydration is not supported. |
| 114 | - if ( ! isset($nonemptyComponents[$parent]) ) { |
|
| 114 | + if ( ! isset($nonemptyComponents[$parent])) { |
|
| 115 | 115 | continue; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | if ($this->_rsm->isMixed && isset($this->_rootAliases[$parent])) { |
| 121 | 121 | $first = reset($this->_resultPointers); |
| 122 | 122 | // TODO: Exception if $key === null ? |
| 123 | - $baseElement =& $this->_resultPointers[$parent][key($first)]; |
|
| 123 | + $baseElement = & $this->_resultPointers[$parent][key($first)]; |
|
| 124 | 124 | } else if (isset($this->_resultPointers[$parent])) { |
| 125 | - $baseElement =& $this->_resultPointers[$parent]; |
|
| 125 | + $baseElement = & $this->_resultPointers[$parent]; |
|
| 126 | 126 | } else { |
| 127 | 127 | unset($this->_resultPointers[$dqlAlias]); // Ticket #1228 |
| 128 | 128 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - $coll =& $baseElement[$relationAlias]; |
|
| 176 | + $coll = & $baseElement[$relationAlias]; |
|
| 177 | 177 | |
| 178 | 178 | if (is_array($coll)) { |
| 179 | 179 | $this->updateResultPointer($coll, $index, $dqlAlias, $oneToOne); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $entityKey = $this->_rsm->entityMappings[$dqlAlias] ?: 0; |
| 186 | 186 | |
| 187 | 187 | // if this row has a NULL value for the root result id then make it a null result. |
| 188 | - if ( ! isset($nonemptyComponents[$dqlAlias]) ) { |
|
| 188 | + if ( ! isset($nonemptyComponents[$dqlAlias])) { |
|
| 189 | 189 | $result[] = $this->_rsm->isMixed |
| 190 | 190 | ? array($entityKey => null) |
| 191 | 191 | : null; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $resultKey = $this->_resultCounter - 1; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0); |
|
| 249 | + $scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0); |
|
| 250 | 250 | |
| 251 | 251 | foreach ($rowData['newObjects'] as $objIndex => $newObject) { |
| 252 | 252 | $class = $newObject['class']; |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if ($oneToOne) { |
| 287 | - $this->_resultPointers[$dqlAlias] =& $coll; |
|
| 287 | + $this->_resultPointers[$dqlAlias] = & $coll; |
|
| 288 | 288 | |
| 289 | 289 | return; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | if ($index !== false) { |
| 293 | - $this->_resultPointers[$dqlAlias] =& $coll[$index]; |
|
| 293 | + $this->_resultPointers[$dqlAlias] = & $coll[$index]; |
|
| 294 | 294 | |
| 295 | 295 | return; |
| 296 | 296 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | end($coll); |
| 303 | - $this->_resultPointers[$dqlAlias] =& $coll[key($coll)]; |
|
| 303 | + $this->_resultPointers[$dqlAlias] = & $coll[key($coll)]; |
|
| 304 | 304 | |
| 305 | 305 | return; |
| 306 | 306 | } |