@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory) |
| 370 | 370 | { |
| 371 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
| 371 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
| 372 | 372 | $dir = dirname($path); |
| 373 | 373 | |
| 374 | 374 | if ( ! is_dir($dir)) { |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | if ($this->backupExisting && file_exists($path)) { |
| 387 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
| 388 | - if (!copy($path, $backupPath)) { |
|
| 387 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
| 388 | + if ( ! copy($path, $backupPath)) { |
|
| 389 | 389 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $body = str_replace('<spaces>', $this->spaces, $body); |
| 447 | 447 | $last = strrpos($currentCode, '}'); |
| 448 | 448 | |
| 449 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
| 449 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | public function setFieldVisibility($visibility) |
| 511 | 511 | { |
| 512 | 512 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 513 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 513 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | $this->fieldVisibility = $visibility; |
@@ -607,11 +607,11 @@ discard block |
||
| 607 | 607 | */ |
| 608 | 608 | protected function generateEntityNamespace(ClassMetadataInfo $metadata) |
| 609 | 609 | { |
| 610 | - if (! $this->hasNamespace($metadata)) { |
|
| 610 | + if ( ! $this->hasNamespace($metadata)) { |
|
| 611 | 611 | return ''; |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
| 614 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | /** |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | */ |
| 620 | 620 | protected function generateEntityUse() |
| 621 | 621 | { |
| 622 | - if (! $this->generateAnnotations) { |
|
| 622 | + if ( ! $this->generateAnnotations) { |
|
| 623 | 623 | return ''; |
| 624 | 624 | } |
| 625 | 625 | |
@@ -633,8 +633,8 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | protected function generateEntityClassName(ClassMetadataInfo $metadata) |
| 635 | 635 | { |
| 636 | - return 'class ' . $this->getClassName($metadata) . |
|
| 637 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
| 636 | + return 'class '.$this->getClassName($metadata). |
|
| 637 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | /** |
@@ -736,13 +736,13 @@ discard block |
||
| 736 | 736 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
| 737 | 737 | |
| 738 | 738 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
| 739 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
| 740 | - $paramVariable = '$' . $fieldName; |
|
| 739 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
| 740 | + $paramVariable = '$'.$fieldName; |
|
| 741 | 741 | |
| 742 | 742 | $paramTypes[] = $paramType; |
| 743 | 743 | $paramVariables[] = $paramVariable; |
| 744 | - $params[] = $paramType . ' ' . $paramVariable; |
|
| 745 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
| 744 | + $params[] = $paramType.' '.$paramVariable; |
|
| 745 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | foreach ($fieldMappings as $fieldMapping) { |
@@ -750,27 +750,27 @@ discard block |
||
| 750 | 750 | continue; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 754 | - $param = '$' . $fieldMapping['fieldName']; |
|
| 753 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
| 754 | + $param = '$'.$fieldMapping['fieldName']; |
|
| 755 | 755 | $paramVariables[] = $param; |
| 756 | 756 | |
| 757 | 757 | if ($fieldMapping['type'] === 'datetime') { |
| 758 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
| 758 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - if (!empty($fieldMapping['nullable'])) { |
|
| 761 | + if ( ! empty($fieldMapping['nullable'])) { |
|
| 762 | 762 | $param .= ' = null'; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | $params[] = $param; |
| 766 | 766 | |
| 767 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
| 767 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
| 771 | 771 | $paramTags = array_map( |
| 772 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
| 773 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
| 772 | + function($type, $variable) use ($maxParamTypeLength) { |
|
| 773 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
| 774 | 774 | }, |
| 775 | 775 | $paramTypes, |
| 776 | 776 | $paramVariables |
@@ -778,8 +778,8 @@ discard block |
||
| 778 | 778 | |
| 779 | 779 | // Generate multi line constructor if the signature exceeds 120 characters. |
| 780 | 780 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
| 781 | - $delimiter = "\n" . $this->spaces; |
|
| 782 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
| 781 | + $delimiter = "\n".$this->spaces; |
|
| 782 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
| 783 | 783 | } else { |
| 784 | 784 | $params = implode(', ', $params); |
| 785 | 785 | } |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | $replacements = [ |
| 788 | 788 | '<paramTags>' => implode("\n * ", $paramTags), |
| 789 | 789 | '<params>' => $params, |
| 790 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
| 790 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
| 791 | 791 | ]; |
| 792 | 792 | |
| 793 | 793 | $constructor = str_replace( |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | if ($inClass) { |
| 834 | 834 | $inClass = false; |
| 835 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
| 835 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
| 836 | 836 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
| 837 | 837 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
| 838 | 838 | } |
@@ -840,16 +840,16 @@ discard block |
||
| 840 | 840 | if (T_NAMESPACE === $token[0]) { |
| 841 | 841 | $lastSeenNamespace = ''; |
| 842 | 842 | $inNamespace = true; |
| 843 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
| 843 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
| 844 | 844 | $inClass = true; |
| 845 | 845 | } elseif (T_FUNCTION === $token[0]) { |
| 846 | - if (T_STRING === $tokens[$i+2][0]) { |
|
| 847 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
| 848 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
| 849 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
| 846 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
| 847 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
| 848 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
| 849 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
| 850 | 850 | } |
| 851 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
| 852 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
| 851 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
| 852 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | */ |
| 863 | 863 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
| 864 | 864 | { |
| 865 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 865 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 866 | 866 | // don't generate property if its already on the base class. |
| 867 | 867 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 868 | 868 | if ($reflClass->hasProperty($property)) { |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | */ |
| 892 | 892 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
| 893 | 893 | { |
| 894 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 894 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
| 895 | 895 | // don't generate method if its already on the base class. |
| 896 | 896 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
| 897 | 897 | |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | */ |
| 923 | 923 | protected function getTraits(ClassMetadataInfo $metadata) |
| 924 | 924 | { |
| 925 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 925 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
| 926 | 926 | return []; |
| 927 | 927 | } |
| 928 | 928 | |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | { |
| 973 | 973 | $refl = new \ReflectionClass($this->getClassToExtend()); |
| 974 | 974 | |
| 975 | - return '\\' . $refl->getName(); |
|
| 975 | + return '\\'.$refl->getName(); |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | /** |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | { |
| 1006 | 1006 | $lines = []; |
| 1007 | 1007 | $lines[] = '/**'; |
| 1008 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
| 1008 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
| 1009 | 1009 | |
| 1010 | 1010 | if ($this->generateAnnotations) { |
| 1011 | 1011 | $lines[] = ' *'; |
@@ -1021,12 +1021,12 @@ discard block |
||
| 1021 | 1021 | |
| 1022 | 1022 | foreach ($methods as $method) { |
| 1023 | 1023 | if ($code = $this->$method($metadata)) { |
| 1024 | - $lines[] = ' * ' . $code; |
|
| 1024 | + $lines[] = ' * '.$code; |
|
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
| 1029 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
| 1029 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | } |
| 1032 | 1032 | |
@@ -1042,17 +1042,17 @@ discard block |
||
| 1042 | 1042 | */ |
| 1043 | 1043 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata) |
| 1044 | 1044 | { |
| 1045 | - $prefix = '@' . $this->annotationsPrefix; |
|
| 1045 | + $prefix = '@'.$this->annotationsPrefix; |
|
| 1046 | 1046 | |
| 1047 | 1047 | if ($metadata->isEmbeddedClass) { |
| 1048 | - return $prefix . 'Embeddable'; |
|
| 1048 | + return $prefix.'Embeddable'; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | $customRepository = $metadata->customRepositoryClassName |
| 1052 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
| 1052 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
| 1053 | 1053 | : ''; |
| 1054 | 1054 | |
| 1055 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
| 1055 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 | /** |
@@ -1069,28 +1069,28 @@ discard block |
||
| 1069 | 1069 | $table = []; |
| 1070 | 1070 | |
| 1071 | 1071 | if (isset($metadata->table['schema'])) { |
| 1072 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
| 1072 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | if (isset($metadata->table['name'])) { |
| 1076 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
| 1076 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
| 1080 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
| 1080 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
| 1084 | 1084 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
| 1085 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
| 1085 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
| 1089 | 1089 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
| 1090 | - $table[] = 'indexes={' . $constraints . '}'; |
|
| 1090 | + $table[] = 'indexes={'.$constraints.'}'; |
|
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
| 1093 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | /** |
@@ -1105,9 +1105,9 @@ discard block |
||
| 1105 | 1105 | foreach ($constraints as $name => $constraint) { |
| 1106 | 1106 | $columns = []; |
| 1107 | 1107 | foreach ($constraint['columns'] as $column) { |
| 1108 | - $columns[] = '"' . $column . '"'; |
|
| 1108 | + $columns[] = '"'.$column.'"'; |
|
| 1109 | 1109 | } |
| 1110 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
| 1110 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | 1113 | return implode(', ', $annotations); |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | return ''; |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1127 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | /** |
@@ -1139,11 +1139,11 @@ discard block |
||
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | $discrColumn = $metadata->discriminatorColumn; |
| 1142 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
| 1143 | - . '", type="' . $discrColumn['type'] |
|
| 1144 | - . '", length=' . $discrColumn['length']; |
|
| 1142 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
| 1143 | + . '", type="'.$discrColumn['type'] |
|
| 1144 | + . '", length='.$discrColumn['length']; |
|
| 1145 | 1145 | |
| 1146 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
| 1146 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | /** |
@@ -1160,10 +1160,10 @@ discard block |
||
| 1160 | 1160 | $inheritanceClassMap = []; |
| 1161 | 1161 | |
| 1162 | 1162 | foreach ($metadata->discriminatorMap as $type => $class) { |
| 1163 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
| 1163 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
| 1166 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | /** |
@@ -1182,8 +1182,8 @@ discard block |
||
| 1182 | 1182 | |
| 1183 | 1183 | $nullableField = $this->nullableFieldExpression($fieldMapping); |
| 1184 | 1184 | |
| 1185 | - if ((!$metadata->isEmbeddedClass || !$this->embeddablesImmutable) |
|
| 1186 | - && (!isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_NONE) |
|
| 1185 | + if (( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
| 1186 | + && ( ! isset($fieldMapping['id']) || ! $fieldMapping['id'] || $metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_NONE) |
|
| 1187 | 1187 | && $code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'], $nullableField) |
| 1188 | 1188 | ) { |
| 1189 | 1189 | $methods[] = $code; |
@@ -1254,7 +1254,7 @@ discard block |
||
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | foreach ($joinColumns as $joinColumn) { |
| 1257 | - if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
| 1257 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
| 1258 | 1258 | return false; |
| 1259 | 1259 | } |
| 1260 | 1260 | } |
@@ -1299,8 +1299,8 @@ discard block |
||
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | 1301 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
| 1302 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
| 1303 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
| 1302 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
| 1303 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | return implode("\n", $lines); |
@@ -1328,12 +1328,12 @@ discard block |
||
| 1328 | 1328 | if ($fieldMapping['type'] === 'boolean' && $fieldMapping['options']['default'] === '1') { |
| 1329 | 1329 | $defaultValue = ' = true'; |
| 1330 | 1330 | } else { |
| 1331 | - $defaultValue = ' = ' . var_export($fieldMapping['options']['default'], true); |
|
| 1331 | + $defaultValue = ' = '.var_export($fieldMapping['options']['default'], true); |
|
| 1332 | 1332 | } |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
| 1336 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] . $defaultValue . ";\n"; |
|
| 1336 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'].$defaultValue.";\n"; |
|
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | return implode("\n", $lines); |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | 1356 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
| 1357 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
| 1357 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 1360 | return implode("\n", $lines); |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | */ |
| 1372 | 1372 | protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
| 1373 | 1373 | { |
| 1374 | - $methodName = $type . Inflector::classify($fieldName); |
|
| 1374 | + $methodName = $type.Inflector::classify($fieldName); |
|
| 1375 | 1375 | $variableName = Inflector::camelize($fieldName); |
| 1376 | 1376 | if (in_array($type, ["add", "remove"])) { |
| 1377 | 1377 | $methodName = Inflector::singularize($methodName); |
@@ -1391,18 +1391,18 @@ discard block |
||
| 1391 | 1391 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
| 1392 | 1392 | |
| 1393 | 1393 | if ($typeHint && ! isset($types[$typeHint])) { |
| 1394 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
| 1395 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
| 1394 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
| 1395 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | $replacements = [ |
| 1399 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
| 1399 | + '<description>' => ucfirst($type).' '.$variableName.'.', |
|
| 1400 | 1400 | '<methodTypeHint>' => $methodTypeHint, |
| 1401 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
| 1401 | + '<variableType>' => $variableType.(null !== $defaultValue ? ('|'.$defaultValue) : ''), |
|
| 1402 | 1402 | '<variableName>' => $variableName, |
| 1403 | 1403 | '<methodName>' => $methodName, |
| 1404 | 1404 | '<fieldName>' => $fieldName, |
| 1405 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
| 1405 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
| 1406 | 1406 | '<entity>' => $this->getClassName($metadata) |
| 1407 | 1407 | ]; |
| 1408 | 1408 | |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
| 1432 | 1432 | |
| 1433 | 1433 | $replacements = [ |
| 1434 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
| 1434 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
| 1435 | 1435 | '<methodName>' => $methodName, |
| 1436 | 1436 | ]; |
| 1437 | 1437 | |
@@ -1454,30 +1454,30 @@ discard block |
||
| 1454 | 1454 | $joinColumnAnnot = []; |
| 1455 | 1455 | |
| 1456 | 1456 | if (isset($joinColumn['name'])) { |
| 1457 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
| 1457 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | 1460 | if (isset($joinColumn['referencedColumnName'])) { |
| 1461 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
| 1461 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
| 1465 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1465 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | if (isset($joinColumn['nullable'])) { |
| 1469 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1469 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
| 1470 | 1470 | } |
| 1471 | 1471 | |
| 1472 | 1472 | if (isset($joinColumn['onDelete'])) { |
| 1473 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
| 1473 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | if (isset($joinColumn['columnDefinition'])) { |
| 1477 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
| 1477 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
| 1480 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | 1483 | /** |
@@ -1489,22 +1489,22 @@ discard block |
||
| 1489 | 1489 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata) |
| 1490 | 1490 | { |
| 1491 | 1491 | $lines = []; |
| 1492 | - $lines[] = $this->spaces . '/**'; |
|
| 1492 | + $lines[] = $this->spaces.'/**'; |
|
| 1493 | 1493 | |
| 1494 | 1494 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
| 1495 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1495 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
| 1496 | 1496 | } else { |
| 1497 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1497 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | if ($this->generateAnnotations) { |
| 1501 | - $lines[] = $this->spaces . ' *'; |
|
| 1501 | + $lines[] = $this->spaces.' *'; |
|
| 1502 | 1502 | |
| 1503 | 1503 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
| 1504 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1504 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1505 | 1505 | |
| 1506 | 1506 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1507 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1507 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1508 | 1508 | } |
| 1509 | 1509 | } |
| 1510 | 1510 | |
@@ -1526,15 +1526,15 @@ discard block |
||
| 1526 | 1526 | $typeOptions = []; |
| 1527 | 1527 | |
| 1528 | 1528 | if (isset($associationMapping['targetEntity'])) { |
| 1529 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
| 1529 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | if (isset($associationMapping['inversedBy'])) { |
| 1533 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
| 1533 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | if (isset($associationMapping['mappedBy'])) { |
| 1537 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
| 1537 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
| 1538 | 1538 | } |
| 1539 | 1539 | |
| 1540 | 1540 | if ($associationMapping['cascade']) { |
@@ -1550,11 +1550,11 @@ discard block |
||
| 1550 | 1550 | $cascades = ['"all"']; |
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
| 1553 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
| 1557 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1557 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1563,71 +1563,71 @@ discard block |
||
| 1563 | 1563 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
| 1564 | 1564 | ]; |
| 1565 | 1565 | |
| 1566 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
| 1566 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
| 1569 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
| 1570 | 1570 | |
| 1571 | 1571 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
| 1572 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
| 1572 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
| 1573 | 1573 | |
| 1574 | 1574 | $joinColumnsLines = []; |
| 1575 | 1575 | |
| 1576 | 1576 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
| 1577 | 1577 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
| 1578 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
| 1578 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | $lines[] = implode(",\n", $joinColumnsLines); |
| 1583 | - $lines[] = $this->spaces . ' * })'; |
|
| 1583 | + $lines[] = $this->spaces.' * })'; |
|
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
| 1587 | 1587 | $joinTable = []; |
| 1588 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
| 1588 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
| 1589 | 1589 | |
| 1590 | 1590 | if (isset($associationMapping['joinTable']['schema'])) { |
| 1591 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
| 1591 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
| 1592 | 1592 | } |
| 1593 | 1593 | |
| 1594 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
| 1595 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
| 1594 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
| 1595 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
| 1596 | 1596 | |
| 1597 | 1597 | $joinColumnsLines = []; |
| 1598 | 1598 | |
| 1599 | 1599 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
| 1600 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1600 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
| 1604 | - $lines[] = $this->spaces . ' * },'; |
|
| 1605 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
| 1603 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
| 1604 | + $lines[] = $this->spaces.' * },'; |
|
| 1605 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
| 1606 | 1606 | |
| 1607 | 1607 | $inverseJoinColumnsLines = []; |
| 1608 | 1608 | |
| 1609 | 1609 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
| 1610 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
| 1610 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
| 1614 | - $lines[] = $this->spaces . ' * }'; |
|
| 1615 | - $lines[] = $this->spaces . ' * )'; |
|
| 1613 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
| 1614 | + $lines[] = $this->spaces.' * }'; |
|
| 1615 | + $lines[] = $this->spaces.' * )'; |
|
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | 1618 | if (isset($associationMapping['orderBy'])) { |
| 1619 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
| 1619 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
| 1620 | 1620 | |
| 1621 | 1621 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
| 1622 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
| 1622 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | 1625 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
| 1626 | - $lines[] = $this->spaces . ' * })'; |
|
| 1626 | + $lines[] = $this->spaces.' * })'; |
|
| 1627 | 1627 | } |
| 1628 | 1628 | } |
| 1629 | 1629 | |
| 1630 | - $lines[] = $this->spaces . ' */'; |
|
| 1630 | + $lines[] = $this->spaces.' */'; |
|
| 1631 | 1631 | |
| 1632 | 1632 | return implode("\n", $lines); |
| 1633 | 1633 | } |
@@ -1641,43 +1641,43 @@ discard block |
||
| 1641 | 1641 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata) |
| 1642 | 1642 | { |
| 1643 | 1643 | $lines = []; |
| 1644 | - $lines[] = $this->spaces . '/**'; |
|
| 1645 | - $lines[] = $this->spaces . ' * @var ' |
|
| 1644 | + $lines[] = $this->spaces.'/**'; |
|
| 1645 | + $lines[] = $this->spaces.' * @var ' |
|
| 1646 | 1646 | . $this->getType($fieldMapping['type']) |
| 1647 | 1647 | . ($this->nullableFieldExpression($fieldMapping) ? '|null' : ''); |
| 1648 | 1648 | |
| 1649 | 1649 | if ($this->generateAnnotations) { |
| 1650 | - $lines[] = $this->spaces . ' *'; |
|
| 1650 | + $lines[] = $this->spaces.' *'; |
|
| 1651 | 1651 | |
| 1652 | 1652 | $column = []; |
| 1653 | 1653 | if (isset($fieldMapping['columnName'])) { |
| 1654 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
| 1654 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | if (isset($fieldMapping['type'])) { |
| 1658 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
| 1658 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | if (isset($fieldMapping['length'])) { |
| 1662 | - $column[] = 'length=' . $fieldMapping['length']; |
|
| 1662 | + $column[] = 'length='.$fieldMapping['length']; |
|
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | if (isset($fieldMapping['precision'])) { |
| 1666 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
| 1666 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | 1669 | if (isset($fieldMapping['scale'])) { |
| 1670 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
| 1670 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | if (isset($fieldMapping['nullable'])) { |
| 1674 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
| 1674 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | 1677 | $options = []; |
| 1678 | 1678 | |
| 1679 | 1679 | if (isset($fieldMapping['options']['default']) && $fieldMapping['options']['default']) { |
| 1680 | - $options[] = '"default"="' . $fieldMapping['options']['default'] .'"'; |
|
| 1680 | + $options[] = '"default"="'.$fieldMapping['options']['default'].'"'; |
|
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | 1683 | if (isset($fieldMapping['options']['unsigned']) && $fieldMapping['options']['unsigned']) { |
@@ -1689,15 +1689,15 @@ discard block |
||
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | if (isset($fieldMapping['options']['comment']) && $fieldMapping['options']['comment']) { |
| 1692 | - $options[] = '"comment"="' . str_replace('"', '""', $fieldMapping['options']['comment']) . '"'; |
|
| 1692 | + $options[] = '"comment"="'.str_replace('"', '""', $fieldMapping['options']['comment']).'"'; |
|
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | if (isset($fieldMapping['options']['collation']) && $fieldMapping['options']['collation']) { |
| 1696 | - $options[] = '"collation"="' . $fieldMapping['options']['collation'] .'"'; |
|
| 1696 | + $options[] = '"collation"="'.$fieldMapping['options']['collation'].'"'; |
|
| 1697 | 1697 | } |
| 1698 | 1698 | |
| 1699 | 1699 | if (isset($fieldMapping['options']['check']) && $fieldMapping['options']['check']) { |
| 1700 | - $options[] = '"check"="' . $fieldMapping['options']['check'] .'"'; |
|
| 1700 | + $options[] = '"check"="'.$fieldMapping['options']['check'].'"'; |
|
| 1701 | 1701 | } |
| 1702 | 1702 | |
| 1703 | 1703 | if ($options) { |
@@ -1705,47 +1705,47 @@ discard block |
||
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | if (isset($fieldMapping['columnDefinition'])) { |
| 1708 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
| 1708 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | if (isset($fieldMapping['unique'])) { |
| 1712 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
| 1712 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
| 1715 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
| 1716 | 1716 | |
| 1717 | 1717 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
| 1718 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
| 1718 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
| 1719 | 1719 | |
| 1720 | 1720 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
| 1721 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
| 1721 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
| 1722 | 1722 | } |
| 1723 | 1723 | |
| 1724 | 1724 | if ($metadata->sequenceGeneratorDefinition) { |
| 1725 | 1725 | $sequenceGenerator = []; |
| 1726 | 1726 | |
| 1727 | 1727 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
| 1728 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
| 1728 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | 1731 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
| 1732 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1732 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | 1735 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
| 1736 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1736 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
| 1737 | 1737 | } |
| 1738 | 1738 | |
| 1739 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
| 1739 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
| 1740 | 1740 | } |
| 1741 | 1741 | } |
| 1742 | 1742 | |
| 1743 | 1743 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
| 1744 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
| 1744 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
| 1745 | 1745 | } |
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | - $lines[] = $this->spaces . ' */'; |
|
| 1748 | + $lines[] = $this->spaces.' */'; |
|
| 1749 | 1749 | |
| 1750 | 1750 | return implode("\n", $lines); |
| 1751 | 1751 | } |
@@ -1758,27 +1758,27 @@ discard block |
||
| 1758 | 1758 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
| 1759 | 1759 | { |
| 1760 | 1760 | $lines = []; |
| 1761 | - $lines[] = $this->spaces . '/**'; |
|
| 1762 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
| 1761 | + $lines[] = $this->spaces.'/**'; |
|
| 1762 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
| 1763 | 1763 | |
| 1764 | 1764 | if ($this->generateAnnotations) { |
| 1765 | - $lines[] = $this->spaces . ' *'; |
|
| 1765 | + $lines[] = $this->spaces.' *'; |
|
| 1766 | 1766 | |
| 1767 | - $embedded = ['class="' . $embeddedClass['class'] . '"']; |
|
| 1767 | + $embedded = ['class="'.$embeddedClass['class'].'"']; |
|
| 1768 | 1768 | |
| 1769 | 1769 | if (isset($embeddedClass['columnPrefix'])) { |
| 1770 | 1770 | if (is_string($embeddedClass['columnPrefix'])) { |
| 1771 | - $embedded[] = 'columnPrefix="' . $embeddedClass['columnPrefix'] . '"'; |
|
| 1771 | + $embedded[] = 'columnPrefix="'.$embeddedClass['columnPrefix'].'"'; |
|
| 1772 | 1772 | } else { |
| 1773 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
| 1773 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
| 1774 | 1774 | } |
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | - $lines[] = $this->spaces . ' * @' . |
|
| 1778 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
| 1777 | + $lines[] = $this->spaces.' * @'. |
|
| 1778 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | - $lines[] = $this->spaces . ' */'; |
|
| 1781 | + $lines[] = $this->spaces.' */'; |
|
| 1782 | 1782 | |
| 1783 | 1783 | return implode("\n", $lines); |
| 1784 | 1784 | } |
@@ -1792,13 +1792,13 @@ discard block |
||
| 1792 | 1792 | $processedClasses = []; |
| 1793 | 1793 | foreach ($metadata->entityListeners as $event => $eventListeners) { |
| 1794 | 1794 | foreach ($eventListeners as $eventListener) { |
| 1795 | - $processedClasses[] = '"' . $eventListener['class'] . '"'; |
|
| 1795 | + $processedClasses[] = '"'.$eventListener['class'].'"'; |
|
| 1796 | 1796 | } |
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | return \sprintf( |
| 1800 | 1800 | '%s%s({%s})', |
| 1801 | - '@' . $this->annotationsPrefix, |
|
| 1801 | + '@'.$this->annotationsPrefix, |
|
| 1802 | 1802 | 'EntityListeners', |
| 1803 | 1803 | \implode(',', \array_unique($processedClasses)) |
| 1804 | 1804 | ); |
@@ -1816,7 +1816,7 @@ discard block |
||
| 1816 | 1816 | |
| 1817 | 1817 | foreach ($lines as $key => $value) { |
| 1818 | 1818 | if ( ! empty($value)) { |
| 1819 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
| 1819 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
| 1820 | 1820 | } |
| 1821 | 1821 | } |
| 1822 | 1822 | |
@@ -1898,9 +1898,9 @@ discard block |
||
| 1898 | 1898 | |
| 1899 | 1899 | foreach ($options as $name => $option) { |
| 1900 | 1900 | if (is_array($option)) { |
| 1901 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
| 1901 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
| 1902 | 1902 | } else { |
| 1903 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
| 1903 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
| 1904 | 1904 | } |
| 1905 | 1905 | } |
| 1906 | 1906 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->_namespace = uniqid("doctrine_"); |
| 29 | 29 | $this->_tmpDir = \sys_get_temp_dir(); |
| 30 | - \mkdir($this->_tmpDir . \DIRECTORY_SEPARATOR . $this->_namespace); |
|
| 30 | + \mkdir($this->_tmpDir.\DIRECTORY_SEPARATOR.$this->_namespace); |
|
| 31 | 31 | $this->_generator = new EntityGenerator(); |
| 32 | 32 | $this->_generator->setAnnotationPrefix(""); |
| 33 | 33 | $this->_generator->setGenerateAnnotations(true); |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function tearDown() |
| 41 | 41 | { |
| 42 | - $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir . '/' . $this->_namespace)); |
|
| 42 | + $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir.'/'.$this->_namespace)); |
|
| 43 | 43 | foreach ($ri AS $file) { |
| 44 | 44 | /* @var $file \SplFileInfo */ |
| 45 | 45 | if ($file->isFile()) { |
| 46 | 46 | \unlink($file->getPathname()); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | - rmdir($this->_tmpDir . '/' . $this->_namespace); |
|
| 49 | + rmdir($this->_tmpDir.'/'.$this->_namespace); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function generateBookEntityFixture(array $embeddedClasses = []) |
| 58 | 58 | { |
| 59 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); |
|
| 59 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorBook'); |
|
| 60 | 60 | $metadata->namespace = $this->_namespace; |
| 61 | - $metadata->customRepositoryClassName = $this->_namespace . '\EntityGeneratorBookRepository'; |
|
| 61 | + $metadata->customRepositoryClassName = $this->_namespace.'\EntityGeneratorBookRepository'; |
|
| 62 | 62 | |
| 63 | 63 | $metadata->table['name'] = 'book'; |
| 64 | 64 | $metadata->table['uniqueConstraints']['name_uniq'] = ['columns' => ['name']]; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | private function generateEntityTypeFixture(array $field) |
| 102 | 102 | { |
| 103 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityType'); |
|
| 103 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityType'); |
|
| 104 | 104 | $metadata->namespace = $this->_namespace; |
| 105 | 105 | |
| 106 | 106 | $metadata->table['name'] = 'entity_type'; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
| 123 | 123 | { |
| 124 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorIsbn'); |
|
| 124 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorIsbn'); |
|
| 125 | 125 | $metadata->namespace = $this->_namespace; |
| 126 | 126 | $metadata->isEmbeddedClass = true; |
| 127 | 127 | $metadata->mapField(['fieldName' => 'prefix', 'type' => 'integer']); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | private function generateTestEmbeddableFixture() |
| 146 | 146 | { |
| 147 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorTestEmbeddable'); |
|
| 147 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorTestEmbeddable'); |
|
| 148 | 148 | $metadata->namespace = $this->_namespace; |
| 149 | 149 | $metadata->isEmbeddedClass = true; |
| 150 | 150 | $metadata->mapField(['fieldName' => 'field1', 'type' => 'integer']); |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | foreach ($embeddableMetadata->embeddedClasses as $property => $embeddableClass) { |
| 188 | 188 | $classMetadata->mapEmbedded( |
| 189 | 189 | [ |
| 190 | - 'fieldName' => $fieldName . '.' . $property, |
|
| 190 | + 'fieldName' => $fieldName.'.'.$property, |
|
| 191 | 191 | 'class' => $embeddableClass['class'], |
| 192 | 192 | 'columnPrefix' => $embeddableClass['columnPrefix'], |
| 193 | 193 | 'declaredField' => $embeddableClass['declaredField'] |
| 194 | - ? $fieldName . '.' . $embeddableClass['declaredField'] |
|
| 194 | + ? $fieldName.'.'.$embeddableClass['declaredField'] |
|
| 195 | 195 | : $fieldName, |
| 196 | 196 | 'originalField' => $embeddableClass['originalField'] ?: $property, |
| 197 | 197 | ] |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | private function loadEntityClass(ClassMetadataInfo $metadata) |
| 206 | 206 | { |
| 207 | 207 | $className = basename(str_replace('\\', '/', $metadata->name)); |
| 208 | - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; |
|
| 208 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/'.$className.'.php'; |
|
| 209 | 209 | |
| 210 | 210 | $this->assertFileExists($path); |
| 211 | 211 | |
@@ -265,19 +265,19 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $book = $this->newInstance($metadata); |
| 267 | 267 | $this->assertTrue(class_exists($metadata->name), "Class does not exist."); |
| 268 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', '__construct'), "EntityGeneratorBook::__construct() missing."); |
|
| 269 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getId'), "EntityGeneratorBook::getId() missing."); |
|
| 270 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setName'), "EntityGeneratorBook::setName() missing."); |
|
| 271 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getName'), "EntityGeneratorBook::getName() missing."); |
|
| 272 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setStatus'), "EntityGeneratorBook::setStatus() missing."); |
|
| 273 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getStatus'), "EntityGeneratorBook::getStatus() missing."); |
|
| 274 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setAuthor'), "EntityGeneratorBook::setAuthor() missing."); |
|
| 275 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); |
|
| 276 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); |
|
| 277 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'addComment'), "EntityGeneratorBook::addComment() missing."); |
|
| 278 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'removeComment'), "EntityGeneratorBook::removeComment() missing."); |
|
| 279 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setIsbn'), "EntityGeneratorBook::setIsbn() missing."); |
|
| 280 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getIsbn'), "EntityGeneratorBook::getIsbn() missing."); |
|
| 268 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', '__construct'), "EntityGeneratorBook::__construct() missing."); |
|
| 269 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getId'), "EntityGeneratorBook::getId() missing."); |
|
| 270 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setName'), "EntityGeneratorBook::setName() missing."); |
|
| 271 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getName'), "EntityGeneratorBook::getName() missing."); |
|
| 272 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setStatus'), "EntityGeneratorBook::setStatus() missing."); |
|
| 273 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getStatus'), "EntityGeneratorBook::getStatus() missing."); |
|
| 274 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setAuthor'), "EntityGeneratorBook::setAuthor() missing."); |
|
| 275 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); |
|
| 276 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); |
|
| 277 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'addComment'), "EntityGeneratorBook::addComment() missing."); |
|
| 278 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'removeComment'), "EntityGeneratorBook::removeComment() missing."); |
|
| 279 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setIsbn'), "EntityGeneratorBook::setIsbn() missing."); |
|
| 280 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getIsbn'), "EntityGeneratorBook::getIsbn() missing."); |
|
| 281 | 281 | |
| 282 | 282 | $reflClass = new \ReflectionClass($metadata->name); |
| 283 | 283 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 332 | 332 | |
| 333 | - $this->assertFileExists($this->_tmpDir . '/' . $this->_namespace . '/EntityGeneratorBook.php~'); |
|
| 333 | + $this->assertFileExists($this->_tmpDir.'/'.$this->_namespace.'/EntityGeneratorBook.php~'); |
|
| 334 | 334 | |
| 335 | 335 | $book = $this->newInstance($metadata); |
| 336 | 336 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 352 | 352 | |
| 353 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); |
|
| 353 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/EntityGeneratorBook.php~"); |
|
| 354 | 354 | |
| 355 | 355 | $book = $this->newInstance($metadata); |
| 356 | 356 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | // Should not throw a PHP fatal error |
| 396 | 396 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 397 | 397 | |
| 398 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); |
|
| 398 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/EntityGeneratorBook.php~"); |
|
| 399 | 399 | |
| 400 | 400 | $this->newInstance($metadata); |
| 401 | 401 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $this->assertPhpDocReturnType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'getAuthor')); |
| 431 | 431 | $this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'setAuthor')); |
| 432 | 432 | |
| 433 | - $expectedClassName = '\\' . $embeddedMetadata->name; |
|
| 433 | + $expectedClassName = '\\'.$embeddedMetadata->name; |
|
| 434 | 434 | $this->assertPhpDocVarType($expectedClassName, new \ReflectionProperty($book, 'isbn')); |
| 435 | 435 | $this->assertPhpDocReturnType($expectedClassName, new \ReflectionMethod($book, 'getIsbn')); |
| 436 | 436 | $this->assertPhpDocParamType($expectedClassName, new \ReflectionMethod($book, 'setIsbn')); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public function testMappedSuperclassAnnotationGeneration() |
| 542 | 542 | { |
| 543 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); |
|
| 543 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorBook'); |
|
| 544 | 544 | $metadata->namespace = $this->_namespace; |
| 545 | 545 | $metadata->isMappedSuperclass = true; |
| 546 | 546 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | */ |
| 579 | 579 | public function testGenerateEntityWithSequenceGenerator() |
| 580 | 580 | { |
| 581 | - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC1784Entity'); |
|
| 581 | + $metadata = new ClassMetadataInfo($this->_namespace.'\DDC1784Entity'); |
|
| 582 | 582 | $metadata->namespace = $this->_namespace; |
| 583 | 583 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
| 584 | 584 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | ); |
| 592 | 592 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 593 | 593 | |
| 594 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
|
| 595 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
| 594 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR |
|
| 595 | + . $this->_namespace.DIRECTORY_SEPARATOR.'DDC1784Entity.php'; |
|
| 596 | 596 | |
| 597 | 597 | $this->assertFileExists($filename); |
| 598 | 598 | require_once $filename; |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | */ |
| 613 | 613 | public function testGenerateEntityWithMultipleInverseJoinColumns() |
| 614 | 614 | { |
| 615 | - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC2079Entity'); |
|
| 615 | + $metadata = new ClassMetadataInfo($this->_namespace.'\DDC2079Entity'); |
|
| 616 | 616 | $metadata->namespace = $this->_namespace; |
| 617 | 617 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
| 618 | 618 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
@@ -623,20 +623,20 @@ discard block |
||
| 623 | 623 | 'joinTable' => [ |
| 624 | 624 | 'name' => 'unidade_centro_custo', |
| 625 | 625 | 'joinColumns' => [ |
| 626 | - ['name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'], |
|
| 627 | - ['name' => 'idunidade', 'referencedColumnName' => 'idunidade'] |
|
| 626 | + ['name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'], |
|
| 627 | + ['name' => 'idunidade', 'referencedColumnName' => 'idunidade'] |
|
| 628 | 628 | ], |
| 629 | 629 | 'inverseJoinColumns' => [ |
| 630 | - ['name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'], |
|
| 631 | - ['name' => 'idpais', 'referencedColumnName' => 'idpais'], |
|
| 630 | + ['name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'], |
|
| 631 | + ['name' => 'idpais', 'referencedColumnName' => 'idpais'], |
|
| 632 | 632 | ], |
| 633 | 633 | ], |
| 634 | 634 | ] |
| 635 | 635 | ); |
| 636 | 636 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 637 | 637 | |
| 638 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
|
| 639 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; |
|
| 638 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR |
|
| 639 | + . $this->_namespace.DIRECTORY_SEPARATOR.'DDC2079Entity.php'; |
|
| 640 | 640 | |
| 641 | 641 | $this->assertFileExists($filename); |
| 642 | 642 | require_once $filename; |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | $method->setAccessible(true); |
| 667 | 667 | |
| 668 | 668 | foreach ($constants as $name => $value) { |
| 669 | - if( ! preg_match($pattern, $name)) { |
|
| 669 | + if ( ! preg_match($pattern, $name)) { |
|
| 670 | 670 | continue; |
| 671 | 671 | } |
| 672 | 672 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $method->setAccessible(true); |
| 696 | 696 | |
| 697 | 697 | foreach ($constants as $name => $value) { |
| 698 | - if( ! preg_match($pattern, $name)) { |
|
| 698 | + if ( ! preg_match($pattern, $name)) { |
|
| 699 | 699 | continue; |
| 700 | 700 | } |
| 701 | 701 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | $method->setAccessible(true); |
| 725 | 725 | |
| 726 | 726 | foreach ($constants as $name => $value) { |
| 727 | - if( ! preg_match($pattern, $name)) { |
|
| 727 | + if ( ! preg_match($pattern, $name)) { |
|
| 728 | 728 | continue; |
| 729 | 729 | } |
| 730 | 730 | |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | public function testEntityTypeAlias(array $field) |
| 749 | 749 | { |
| 750 | 750 | $metadata = $this->generateEntityTypeFixture($field); |
| 751 | - $path = $this->_tmpDir . '/'. $this->_namespace . '/EntityType.php'; |
|
| 751 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/EntityType.php'; |
|
| 752 | 752 | |
| 753 | 753 | $this->assertFileExists($path); |
| 754 | 754 | require_once $path; |
@@ -759,8 +759,8 @@ discard block |
||
| 759 | 759 | $type = $field['phpType']; |
| 760 | 760 | $name = $field['fieldName']; |
| 761 | 761 | $value = $field['value']; |
| 762 | - $getter = "get" . ucfirst($name); |
|
| 763 | - $setter = "set" . ucfirst($name); |
|
| 762 | + $getter = "get".ucfirst($name); |
|
| 763 | + $setter = "set".ucfirst($name); |
|
| 764 | 764 | |
| 765 | 765 | $this->assertPhpDocVarType($type, $reflClass->getProperty($name)); |
| 766 | 766 | $this->assertPhpDocParamType($type, $reflClass->getMethod($setter)); |
@@ -781,13 +781,13 @@ discard block |
||
| 781 | 781 | |
| 782 | 782 | $user = new DDC2372User(); |
| 783 | 783 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 784 | - $metadata->name = $this->_namespace . "\DDC2372User"; |
|
| 784 | + $metadata->name = $this->_namespace."\DDC2372User"; |
|
| 785 | 785 | $metadata->namespace = $this->_namespace; |
| 786 | 786 | |
| 787 | 787 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 788 | 788 | |
| 789 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php"); |
|
| 790 | - require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php"; |
|
| 789 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/DDC2372User.php"); |
|
| 790 | + require $this->_tmpDir."/".$this->_namespace."/DDC2372User.php"; |
|
| 791 | 791 | |
| 792 | 792 | $reflClass = new \ReflectionClass($metadata->name); |
| 793 | 793 | |
@@ -807,13 +807,13 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | $user = new DDC2372Admin(); |
| 809 | 809 | $metadata = $cmf->getMetadataFor(get_class($user)); |
| 810 | - $metadata->name = $this->_namespace . "\DDC2372Admin"; |
|
| 810 | + $metadata->name = $this->_namespace."\DDC2372Admin"; |
|
| 811 | 811 | $metadata->namespace = $this->_namespace; |
| 812 | 812 | |
| 813 | 813 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 814 | 814 | |
| 815 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php"); |
|
| 816 | - require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php"; |
|
| 815 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/DDC2372Admin.php"); |
|
| 816 | + require $this->_tmpDir."/".$this->_namespace."/DDC2372Admin.php"; |
|
| 817 | 817 | |
| 818 | 818 | $reflClass = new \ReflectionClass($metadata->name); |
| 819 | 819 | |
@@ -833,20 +833,20 @@ discard block |
||
| 833 | 833 | $cmf->setEntityManager($em); |
| 834 | 834 | |
| 835 | 835 | $ns = $this->_namespace; |
| 836 | - $nsdir = $this->_tmpDir . '/' . $ns; |
|
| 836 | + $nsdir = $this->_tmpDir.'/'.$ns; |
|
| 837 | 837 | |
| 838 | 838 | $content = str_replace( |
| 839 | 839 | 'namespace Doctrine\Tests\Models\DDC1590', |
| 840 | - 'namespace ' . $ns, |
|
| 841 | - file_get_contents(__DIR__ . '/../../Models/DDC1590/DDC1590User.php') |
|
| 840 | + 'namespace '.$ns, |
|
| 841 | + file_get_contents(__DIR__.'/../../Models/DDC1590/DDC1590User.php') |
|
| 842 | 842 | ); |
| 843 | 843 | |
| 844 | - $fname = $nsdir . "/DDC1590User.php"; |
|
| 844 | + $fname = $nsdir."/DDC1590User.php"; |
|
| 845 | 845 | file_put_contents($fname, $content); |
| 846 | 846 | require $fname; |
| 847 | 847 | |
| 848 | 848 | |
| 849 | - $metadata = $cmf->getMetadataFor($ns . '\DDC1590User'); |
|
| 849 | + $metadata = $cmf->getMetadataFor($ns.'\DDC1590User'); |
|
| 850 | 850 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 851 | 851 | |
| 852 | 852 | // class DDC1590User extends DDC1590Entity { ... } |
@@ -854,13 +854,13 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | // class _DDC1590User extends DDC1590Entity { ... } |
| 856 | 856 | $source2 = str_replace('class DDC1590User', 'class _DDC1590User', $source); |
| 857 | - $fname2 = $nsdir . "/_DDC1590User.php"; |
|
| 857 | + $fname2 = $nsdir."/_DDC1590User.php"; |
|
| 858 | 858 | file_put_contents($fname2, $source2); |
| 859 | 859 | require $fname2; |
| 860 | 860 | |
| 861 | 861 | // class __DDC1590User { ... } |
| 862 | 862 | $source3 = str_replace('class DDC1590User extends DDC1590Entity', 'class __DDC1590User', $source); |
| 863 | - $fname3 = $nsdir . "/__DDC1590User.php"; |
|
| 863 | + $fname3 = $nsdir."/__DDC1590User.php"; |
|
| 864 | 864 | file_put_contents($fname3, $source3); |
| 865 | 865 | require $fname3; |
| 866 | 866 | |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | $this->loadEntityClass($metadata); |
| 1015 | 1015 | |
| 1016 | 1016 | $className = basename(str_replace('\\', '/', $metadata->name)); |
| 1017 | - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; |
|
| 1017 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/'.$className.'.php'; |
|
| 1018 | 1018 | $classTest = file_get_contents($path); |
| 1019 | 1019 | |
| 1020 | 1020 | $this->_generator->setRegenerateEntityIfExists(true); |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 1024 | 1024 | $classNew = file_get_contents($path); |
| 1025 | 1025 | |
| 1026 | - $this->assertSame($classTest,$classNew); |
|
| 1026 | + $this->assertSame($classTest, $classNew); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | /** |
@@ -1210,14 +1210,14 @@ discard block |
||
| 1210 | 1210 | */ |
| 1211 | 1211 | public function testOptionsAreGeneratedProperly(string $expectedAnnotation, array $fieldConfiguration) : void |
| 1212 | 1212 | { |
| 1213 | - $metadata = new ClassMetadataInfo($this->_namespace . '\GH6703Options'); |
|
| 1213 | + $metadata = new ClassMetadataInfo($this->_namespace.'\GH6703Options'); |
|
| 1214 | 1214 | $metadata->namespace = $this->_namespace; |
| 1215 | 1215 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
| 1216 | 1216 | $metadata->mapField(['fieldName' => 'test'] + $fieldConfiguration); |
| 1217 | 1217 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
| 1218 | 1218 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
| 1219 | 1219 | |
| 1220 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR . $this->_namespace . DIRECTORY_SEPARATOR . 'GH6703Options.php'; |
|
| 1220 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR.$this->_namespace.DIRECTORY_SEPARATOR.'GH6703Options.php'; |
|
| 1221 | 1221 | |
| 1222 | 1222 | self::assertFileExists($filename); |
| 1223 | 1223 | require_once $filename; |