@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | |
1292 | 1292 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
1293 | 1293 | $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
1294 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
1294 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | return implode("\n", $lines); |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
1321 | 1321 | $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
1322 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
1322 | + . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | return implode("\n", $lines); |
@@ -1382,14 +1382,14 @@ discard block |
||
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | $replacements = array( |
1385 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
1386 | - '<methodTypeHint>' => $methodTypeHint, |
|
1387 | - '<variableType>' => $variableType, |
|
1388 | - '<variableName>' => $variableName, |
|
1389 | - '<methodName>' => $methodName, |
|
1390 | - '<fieldName>' => $fieldName, |
|
1391 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
1392 | - '<entity>' => $this->getClassName($metadata) |
|
1385 | + '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
1386 | + '<methodTypeHint>' => $methodTypeHint, |
|
1387 | + '<variableType>' => $variableType, |
|
1388 | + '<variableName>' => $variableName, |
|
1389 | + '<methodName>' => $methodName, |
|
1390 | + '<fieldName>' => $fieldName, |
|
1391 | + '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
1392 | + '<entity>' => $this->getClassName($metadata) |
|
1393 | 1393 | ); |
1394 | 1394 | |
1395 | 1395 | $method = str_replace( |
@@ -364,14 +364,14 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory) |
366 | 366 | { |
367 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
367 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
368 | 368 | $dir = dirname($path); |
369 | 369 | |
370 | 370 | if ( ! is_dir($dir)) { |
371 | 371 | mkdir($dir, 0775, true); |
372 | 372 | } |
373 | 373 | |
374 | - $this->isNew = !file_exists($path) || $this->regenerateEntityIfExists; |
|
374 | + $this->isNew = ! file_exists($path) || $this->regenerateEntityIfExists; |
|
375 | 375 | |
376 | 376 | if ( ! $this->isNew) { |
377 | 377 | $this->parseTokensInEntityFile(file_get_contents($path)); |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | if ($this->backupExisting && file_exists($path)) { |
383 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
384 | - if (!copy($path, $backupPath)) { |
|
383 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
384 | + if ( ! copy($path, $backupPath)) { |
|
385 | 385 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
386 | 386 | } |
387 | 387 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $this->generateEntityBody($metadata) |
422 | 422 | ); |
423 | 423 | |
424 | - $code = str_replace($placeHolders, $replacements, static::$classTemplate) . "\n"; |
|
424 | + $code = str_replace($placeHolders, $replacements, static::$classTemplate)."\n"; |
|
425 | 425 | |
426 | 426 | return str_replace('<spaces>', $this->spaces, $code); |
427 | 427 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $body = str_replace('<spaces>', $this->spaces, $body); |
443 | 443 | $last = strrpos($currentCode, '}'); |
444 | 444 | |
445 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
445 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | public function setFieldVisibility($visibility) |
507 | 507 | { |
508 | 508 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
509 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
509 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | $this->fieldVisibility = $visibility; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | protected function generateEntityNamespace(ClassMetadataInfo $metadata) |
605 | 605 | { |
606 | 606 | if ($this->hasNamespace($metadata)) { |
607 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
607 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | |
@@ -624,8 +624,8 @@ discard block |
||
624 | 624 | */ |
625 | 625 | protected function generateEntityClassName(ClassMetadataInfo $metadata) |
626 | 626 | { |
627 | - return 'class ' . $this->getClassName($metadata) . |
|
628 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
627 | + return 'class '.$this->getClassName($metadata). |
|
628 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | /** |
@@ -727,13 +727,13 @@ discard block |
||
727 | 727 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
728 | 728 | |
729 | 729 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
730 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
731 | - $paramVariable = '$' . $fieldName; |
|
730 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
731 | + $paramVariable = '$'.$fieldName; |
|
732 | 732 | |
733 | 733 | $paramTypes[] = $paramType; |
734 | 734 | $paramVariables[] = $paramVariable; |
735 | - $params[] = $paramType . ' ' . $paramVariable; |
|
736 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
735 | + $params[] = $paramType.' '.$paramVariable; |
|
736 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | foreach ($fieldMappings as $fieldMapping) { |
@@ -743,27 +743,27 @@ discard block |
||
743 | 743 | continue; |
744 | 744 | } |
745 | 745 | |
746 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
747 | - $param = '$' . $fieldMapping['fieldName']; |
|
746 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
747 | + $param = '$'.$fieldMapping['fieldName']; |
|
748 | 748 | $paramVariables[] = $param; |
749 | 749 | |
750 | 750 | if ($fieldMapping['type'] === 'datetime') { |
751 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
751 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
752 | 752 | } |
753 | 753 | |
754 | - if (!empty($fieldMapping['nullable'])) { |
|
754 | + if ( ! empty($fieldMapping['nullable'])) { |
|
755 | 755 | $param .= ' = null'; |
756 | 756 | } |
757 | 757 | |
758 | 758 | $params[] = $param; |
759 | 759 | |
760 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
760 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
764 | 764 | $paramTags = array_map( |
765 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
766 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
765 | + function($type, $variable) use ($maxParamTypeLength) { |
|
766 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
767 | 767 | }, |
768 | 768 | $paramTypes, |
769 | 769 | $paramVariables |
@@ -771,8 +771,8 @@ discard block |
||
771 | 771 | |
772 | 772 | // Generate multi line constructor if the signature exceeds 120 characters. |
773 | 773 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
774 | - $delimiter = "\n" . $this->spaces; |
|
775 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
774 | + $delimiter = "\n".$this->spaces; |
|
775 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
776 | 776 | } else { |
777 | 777 | $params = implode(', ', $params); |
778 | 778 | } |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | $replacements = array( |
781 | 781 | '<paramTags>' => implode("\n * ", $paramTags), |
782 | 782 | '<params>' => $params, |
783 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
783 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
784 | 784 | ); |
785 | 785 | |
786 | 786 | $constructor = str_replace( |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | |
826 | 826 | if ($inClass) { |
827 | 827 | $inClass = false; |
828 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
828 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
829 | 829 | $this->staticReflection[$lastSeenClass]['properties'] = array(); |
830 | 830 | $this->staticReflection[$lastSeenClass]['methods'] = array(); |
831 | 831 | } |
@@ -833,16 +833,16 @@ discard block |
||
833 | 833 | if (T_NAMESPACE === $token[0]) { |
834 | 834 | $lastSeenNamespace = ''; |
835 | 835 | $inNamespace = true; |
836 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
836 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
837 | 837 | $inClass = true; |
838 | 838 | } elseif (T_FUNCTION === $token[0]) { |
839 | - if (T_STRING === $tokens[$i+2][0]) { |
|
840 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
841 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
842 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
839 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
840 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
841 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
842 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
843 | 843 | } |
844 | - } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED), true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
845 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
844 | + } elseif (in_array($token[0], array(T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED), true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
845 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
846 | 846 | } |
847 | 847 | } |
848 | 848 | } |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | */ |
856 | 856 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
857 | 857 | { |
858 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
858 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
859 | 859 | // don't generate property if its already on the base class. |
860 | 860 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
861 | 861 | if ($reflClass->hasProperty($property)) { |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | */ |
885 | 885 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
886 | 886 | { |
887 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
887 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
888 | 888 | // don't generate method if its already on the base class. |
889 | 889 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
890 | 890 | |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | */ |
914 | 914 | protected function getTraits(ClassMetadataInfo $metadata) |
915 | 915 | { |
916 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
916 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
917 | 917 | return []; |
918 | 918 | } |
919 | 919 | |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | { |
966 | 966 | $refl = new \ReflectionClass($this->getClassToExtend()); |
967 | 967 | |
968 | - return '\\' . $refl->getName(); |
|
968 | + return '\\'.$refl->getName(); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | { |
999 | 999 | $lines = array(); |
1000 | 1000 | $lines[] = '/**'; |
1001 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
1001 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
1002 | 1002 | |
1003 | 1003 | if ($this->generateAnnotations) { |
1004 | 1004 | $lines[] = ' *'; |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | |
1014 | 1014 | foreach ($methods as $method) { |
1015 | 1015 | if ($code = $this->$method($metadata)) { |
1016 | - $lines[] = ' * ' . $code; |
|
1016 | + $lines[] = ' * '.$code; |
|
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
1021 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
1021 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | |
@@ -1034,17 +1034,17 @@ discard block |
||
1034 | 1034 | */ |
1035 | 1035 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata) |
1036 | 1036 | { |
1037 | - $prefix = '@' . $this->annotationsPrefix; |
|
1037 | + $prefix = '@'.$this->annotationsPrefix; |
|
1038 | 1038 | |
1039 | 1039 | if ($metadata->isEmbeddedClass) { |
1040 | - return $prefix . 'Embeddable'; |
|
1040 | + return $prefix.'Embeddable'; |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | $customRepository = $metadata->customRepositoryClassName |
1044 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
1044 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
1045 | 1045 | : ''; |
1046 | 1046 | |
1047 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
1047 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | /** |
@@ -1061,28 +1061,28 @@ discard block |
||
1061 | 1061 | $table = array(); |
1062 | 1062 | |
1063 | 1063 | if (isset($metadata->table['schema'])) { |
1064 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
1064 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | if (isset($metadata->table['name'])) { |
1068 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
1068 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
1072 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
1072 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
1076 | 1076 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
1077 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
1077 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
1081 | 1081 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
1082 | - $table[] = 'indexes={' . $constraints . '}'; |
|
1082 | + $table[] = 'indexes={'.$constraints.'}'; |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
1085 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | /** |
@@ -1097,9 +1097,9 @@ discard block |
||
1097 | 1097 | foreach ($constraints as $name => $constraint) { |
1098 | 1098 | $columns = array(); |
1099 | 1099 | foreach ($constraint['columns'] as $column) { |
1100 | - $columns[] = '"' . $column . '"'; |
|
1100 | + $columns[] = '"'.$column.'"'; |
|
1101 | 1101 | } |
1102 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
1102 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | return implode(', ', $annotations); |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | protected function generateInheritanceAnnotation(ClassMetadataInfo $metadata) |
1114 | 1114 | { |
1115 | 1115 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
1116 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
1116 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | |
@@ -1126,11 +1126,11 @@ discard block |
||
1126 | 1126 | { |
1127 | 1127 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
1128 | 1128 | $discrColumn = $metadata->discriminatorColumn; |
1129 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
1130 | - . '", type="' . $discrColumn['type'] |
|
1131 | - . '", length=' . $discrColumn['length']; |
|
1129 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
1130 | + . '", type="'.$discrColumn['type'] |
|
1131 | + . '", length='.$discrColumn['length']; |
|
1132 | 1132 | |
1133 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
1133 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1145,10 +1145,10 @@ discard block |
||
1145 | 1145 | $inheritanceClassMap = array(); |
1146 | 1146 | |
1147 | 1147 | foreach ($metadata->discriminatorMap as $type => $class) { |
1148 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
1148 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
1149 | 1149 | } |
1150 | 1150 | |
1151 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
1151 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
1152 | 1152 | } |
1153 | 1153 | } |
1154 | 1154 | |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | if (( ! isset($fieldMapping['id']) || |
1172 | 1172 | ! $fieldMapping['id'] || |
1173 | 1173 | $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE |
1174 | - ) && (! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
1174 | + ) && ( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
1175 | 1175 | ) { |
1176 | 1176 | if ($code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'])) { |
1177 | 1177 | $methods[] = $code; |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | foreach ($joinColumns as $joinColumn) { |
1246 | - if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
1246 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
1247 | 1247 | return false; |
1248 | 1248 | } |
1249 | 1249 | } |
@@ -1290,8 +1290,8 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
1293 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
1294 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
1293 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
1294 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | return implode("\n", $lines); |
@@ -1318,8 +1318,8 @@ discard block |
||
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
1321 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
|
1322 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
1321 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'] |
|
1322 | + . (isset($fieldMapping['options']['default']) ? ' = '.var_export($fieldMapping['options']['default'], true) : null).";\n"; |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | return implode("\n", $lines); |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
1343 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
1343 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
1344 | 1344 | } |
1345 | 1345 | |
1346 | 1346 | return implode("\n", $lines); |
@@ -1355,9 +1355,9 @@ discard block |
||
1355 | 1355 | * |
1356 | 1356 | * @return string |
1357 | 1357 | */ |
1358 | - protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
|
1358 | + protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null) |
|
1359 | 1359 | { |
1360 | - $methodName = $type . Inflector::classify($fieldName); |
|
1360 | + $methodName = $type.Inflector::classify($fieldName); |
|
1361 | 1361 | $variableName = Inflector::camelize($fieldName); |
1362 | 1362 | if (in_array($type, array("add", "remove"))) { |
1363 | 1363 | $methodName = Inflector::singularize($methodName); |
@@ -1377,18 +1377,18 @@ discard block |
||
1377 | 1377 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
1378 | 1378 | |
1379 | 1379 | if ($typeHint && ! isset($types[$typeHint])) { |
1380 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
1381 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
1380 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
1381 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | $replacements = array( |
1385 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
1385 | + '<description>' => ucfirst($type).' '.$variableName.'.', |
|
1386 | 1386 | '<methodTypeHint>' => $methodTypeHint, |
1387 | 1387 | '<variableType>' => $variableType, |
1388 | 1388 | '<variableName>' => $variableName, |
1389 | 1389 | '<methodName>' => $methodName, |
1390 | 1390 | '<fieldName>' => $fieldName, |
1391 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = '.$defaultValue) : '', |
|
1391 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
1392 | 1392 | '<entity>' => $this->getClassName($metadata) |
1393 | 1393 | ); |
1394 | 1394 | |
@@ -1416,7 +1416,7 @@ discard block |
||
1416 | 1416 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
1417 | 1417 | |
1418 | 1418 | $replacements = array( |
1419 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
1419 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
1420 | 1420 | '<methodName>' => $methodName, |
1421 | 1421 | ); |
1422 | 1422 | |
@@ -1439,30 +1439,30 @@ discard block |
||
1439 | 1439 | $joinColumnAnnot = array(); |
1440 | 1440 | |
1441 | 1441 | if (isset($joinColumn['name'])) { |
1442 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
1442 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | 1445 | if (isset($joinColumn['referencedColumnName'])) { |
1446 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
1446 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
1450 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
1450 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | if (isset($joinColumn['nullable'])) { |
1454 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
1454 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | if (isset($joinColumn['onDelete'])) { |
1458 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
1458 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | if (isset($joinColumn['columnDefinition'])) { |
1462 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
1462 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
1463 | 1463 | } |
1464 | 1464 | |
1465 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
1465 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | /** |
@@ -1474,22 +1474,22 @@ discard block |
||
1474 | 1474 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata) |
1475 | 1475 | { |
1476 | 1476 | $lines = array(); |
1477 | - $lines[] = $this->spaces . '/**'; |
|
1477 | + $lines[] = $this->spaces.'/**'; |
|
1478 | 1478 | |
1479 | 1479 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
1480 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
1480 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
1481 | 1481 | } else { |
1482 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
1482 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | if ($this->generateAnnotations) { |
1486 | - $lines[] = $this->spaces . ' *'; |
|
1486 | + $lines[] = $this->spaces.' *'; |
|
1487 | 1487 | |
1488 | 1488 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
1489 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
1489 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
1490 | 1490 | |
1491 | 1491 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
1492 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
1492 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
1493 | 1493 | } |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1511,15 +1511,15 @@ discard block |
||
1511 | 1511 | $typeOptions = array(); |
1512 | 1512 | |
1513 | 1513 | if (isset($associationMapping['targetEntity'])) { |
1514 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
1514 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
1515 | 1515 | } |
1516 | 1516 | |
1517 | 1517 | if (isset($associationMapping['inversedBy'])) { |
1518 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
1518 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | if (isset($associationMapping['mappedBy'])) { |
1522 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
1522 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
1523 | 1523 | } |
1524 | 1524 | |
1525 | 1525 | if ($associationMapping['cascade']) { |
@@ -1535,11 +1535,11 @@ discard block |
||
1535 | 1535 | $cascades = array('"all"'); |
1536 | 1536 | } |
1537 | 1537 | |
1538 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
1538 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
1542 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
1542 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1548,71 +1548,71 @@ discard block |
||
1548 | 1548 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
1549 | 1549 | ); |
1550 | 1550 | |
1551 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
1551 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
1552 | 1552 | } |
1553 | 1553 | |
1554 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
1554 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
1555 | 1555 | |
1556 | 1556 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
1557 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
1557 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
1558 | 1558 | |
1559 | 1559 | $joinColumnsLines = array(); |
1560 | 1560 | |
1561 | 1561 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
1562 | 1562 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
1563 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
1563 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | |
1567 | 1567 | $lines[] = implode(",\n", $joinColumnsLines); |
1568 | - $lines[] = $this->spaces . ' * })'; |
|
1568 | + $lines[] = $this->spaces.' * })'; |
|
1569 | 1569 | } |
1570 | 1570 | |
1571 | 1571 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
1572 | 1572 | $joinTable = array(); |
1573 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
1573 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
1574 | 1574 | |
1575 | 1575 | if (isset($associationMapping['joinTable']['schema'])) { |
1576 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
1576 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
1577 | 1577 | } |
1578 | 1578 | |
1579 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
1580 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
1579 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
1580 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
1581 | 1581 | |
1582 | 1582 | $joinColumnsLines = array(); |
1583 | 1583 | |
1584 | 1584 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
1585 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
1585 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
1589 | - $lines[] = $this->spaces . ' * },'; |
|
1590 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
1588 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
1589 | + $lines[] = $this->spaces.' * },'; |
|
1590 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
1591 | 1591 | |
1592 | 1592 | $inverseJoinColumnsLines = array(); |
1593 | 1593 | |
1594 | 1594 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
1595 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
1595 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
1596 | 1596 | } |
1597 | 1597 | |
1598 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
1599 | - $lines[] = $this->spaces . ' * }'; |
|
1600 | - $lines[] = $this->spaces . ' * )'; |
|
1598 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
1599 | + $lines[] = $this->spaces.' * }'; |
|
1600 | + $lines[] = $this->spaces.' * )'; |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | if (isset($associationMapping['orderBy'])) { |
1604 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
1604 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
1605 | 1605 | |
1606 | 1606 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
1607 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
1607 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
1608 | 1608 | } |
1609 | 1609 | |
1610 | 1610 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
1611 | - $lines[] = $this->spaces . ' * })'; |
|
1611 | + $lines[] = $this->spaces.' * })'; |
|
1612 | 1612 | } |
1613 | 1613 | } |
1614 | 1614 | |
1615 | - $lines[] = $this->spaces . ' */'; |
|
1615 | + $lines[] = $this->spaces.' */'; |
|
1616 | 1616 | |
1617 | 1617 | return implode("\n", $lines); |
1618 | 1618 | } |
@@ -1626,35 +1626,35 @@ discard block |
||
1626 | 1626 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata) |
1627 | 1627 | { |
1628 | 1628 | $lines = array(); |
1629 | - $lines[] = $this->spaces . '/**'; |
|
1630 | - $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']); |
|
1629 | + $lines[] = $this->spaces.'/**'; |
|
1630 | + $lines[] = $this->spaces.' * @var '.$this->getType($fieldMapping['type']); |
|
1631 | 1631 | |
1632 | 1632 | if ($this->generateAnnotations) { |
1633 | - $lines[] = $this->spaces . ' *'; |
|
1633 | + $lines[] = $this->spaces.' *'; |
|
1634 | 1634 | |
1635 | 1635 | $column = array(); |
1636 | 1636 | if (isset($fieldMapping['columnName'])) { |
1637 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
1637 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
1638 | 1638 | } |
1639 | 1639 | |
1640 | 1640 | if (isset($fieldMapping['type'])) { |
1641 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
1641 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | if (isset($fieldMapping['length'])) { |
1645 | - $column[] = 'length=' . $fieldMapping['length']; |
|
1645 | + $column[] = 'length='.$fieldMapping['length']; |
|
1646 | 1646 | } |
1647 | 1647 | |
1648 | 1648 | if (isset($fieldMapping['precision'])) { |
1649 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
1649 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
1650 | 1650 | } |
1651 | 1651 | |
1652 | 1652 | if (isset($fieldMapping['scale'])) { |
1653 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
1653 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | if (isset($fieldMapping['nullable'])) { |
1657 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
1657 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | $options = []; |
@@ -1668,47 +1668,47 @@ discard block |
||
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | if (isset($fieldMapping['columnDefinition'])) { |
1671 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
1671 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | 1674 | if (isset($fieldMapping['unique'])) { |
1675 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
1675 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
1676 | 1676 | } |
1677 | 1677 | |
1678 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
1678 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
1679 | 1679 | |
1680 | 1680 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
1681 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
1681 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
1682 | 1682 | |
1683 | 1683 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
1684 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
1684 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
1685 | 1685 | } |
1686 | 1686 | |
1687 | 1687 | if ($metadata->sequenceGeneratorDefinition) { |
1688 | 1688 | $sequenceGenerator = array(); |
1689 | 1689 | |
1690 | 1690 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
1691 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
1691 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
1695 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
1695 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
1699 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
1699 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
1700 | 1700 | } |
1701 | 1701 | |
1702 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
1702 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
1703 | 1703 | } |
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
1707 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
1707 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
1708 | 1708 | } |
1709 | 1709 | } |
1710 | 1710 | |
1711 | - $lines[] = $this->spaces . ' */'; |
|
1711 | + $lines[] = $this->spaces.' */'; |
|
1712 | 1712 | |
1713 | 1713 | return implode("\n", $lines); |
1714 | 1714 | } |
@@ -1721,23 +1721,23 @@ discard block |
||
1721 | 1721 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass) |
1722 | 1722 | { |
1723 | 1723 | $lines = array(); |
1724 | - $lines[] = $this->spaces . '/**'; |
|
1725 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
1724 | + $lines[] = $this->spaces.'/**'; |
|
1725 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
1726 | 1726 | |
1727 | 1727 | if ($this->generateAnnotations) { |
1728 | - $lines[] = $this->spaces . ' *'; |
|
1728 | + $lines[] = $this->spaces.' *'; |
|
1729 | 1729 | |
1730 | - $embedded = array('class="' . $embeddedClass['class'] . '"'); |
|
1730 | + $embedded = array('class="'.$embeddedClass['class'].'"'); |
|
1731 | 1731 | |
1732 | 1732 | if (isset($fieldMapping['columnPrefix'])) { |
1733 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
1733 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
1734 | 1734 | } |
1735 | 1735 | |
1736 | - $lines[] = $this->spaces . ' * @' . |
|
1737 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
1736 | + $lines[] = $this->spaces.' * @'. |
|
1737 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
1738 | 1738 | } |
1739 | 1739 | |
1740 | - $lines[] = $this->spaces . ' */'; |
|
1740 | + $lines[] = $this->spaces.' */'; |
|
1741 | 1741 | |
1742 | 1742 | return implode("\n", $lines); |
1743 | 1743 | } |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | |
1755 | 1755 | foreach ($lines as $key => $value) { |
1756 | 1756 | if ( ! empty($value)) { |
1757 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
1757 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
1758 | 1758 | } |
1759 | 1759 | } |
1760 | 1760 | |
@@ -1822,9 +1822,9 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | foreach ($options as $name => $option) { |
1824 | 1824 | if (is_array($option)) { |
1825 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
1825 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
1826 | 1826 | } else { |
1827 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
1827 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
1828 | 1828 | } |
1829 | 1829 | } |
1830 | 1830 |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | public function getSingleIdReflectionProperty() |
697 | 697 | { |
698 | 698 | if ($this->isIdentifierComposite) { |
699 | - throw new BadMethodCallException("Class " . $this->name . " has a composite identifier."); |
|
699 | + throw new BadMethodCallException("Class ".$this->name." has a composite identifier."); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | return $this->reflFields[$this->identifier[0]]; |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | public function __toString() |
793 | 793 | { |
794 | - return __CLASS__ . '@' . spl_object_hash($this); |
|
794 | + return __CLASS__.'@'.spl_object_hash($this); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | public function validateAssociations() |
1026 | 1026 | { |
1027 | 1027 | foreach ($this->associationMappings as $mapping) { |
1028 | - if ( ! ClassLoader::classExists($mapping['targetEntity']) ) { |
|
1028 | + if ( ! ClassLoader::classExists($mapping['targetEntity'])) { |
|
1029 | 1029 | throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']); |
1030 | 1030 | } |
1031 | 1031 | } |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | if ( ! isset($cache['region'])) { |
1106 | - $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName; |
|
1106 | + $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)).'__'.$fieldName; |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | return $cache; |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | protected function _validateAndCompleteFieldMapping(array &$mapping) |
1384 | 1384 | { |
1385 | 1385 | // Check mandatory fields |
1386 | - if ( ! isset($mapping['fieldName']) || !$mapping['fieldName']) { |
|
1386 | + if ( ! isset($mapping['fieldName']) || ! $mapping['fieldName']) { |
|
1387 | 1387 | throw MappingException::missingFieldName($this->name); |
1388 | 1388 | } |
1389 | 1389 | |
@@ -1496,14 +1496,14 @@ discard block |
||
1496 | 1496 | $this->isIdentifierComposite = true; |
1497 | 1497 | } |
1498 | 1498 | |
1499 | - if ($this->cache && !isset($mapping['cache'])) { |
|
1499 | + if ($this->cache && ! isset($mapping['cache'])) { |
|
1500 | 1500 | throw CacheException::nonCacheableEntityAssociation($this->name, $mapping['fieldName']); |
1501 | 1501 | } |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | // Mandatory attributes for both sides |
1505 | 1505 | // Mandatory: fieldName, targetEntity |
1506 | - if ( ! isset($mapping['fieldName']) || !$mapping['fieldName']) { |
|
1506 | + if ( ! isset($mapping['fieldName']) || ! $mapping['fieldName']) { |
|
1507 | 1507 | throw MappingException::missingFieldName($this->name); |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1627,7 +1627,7 @@ discard block |
||
1627 | 1627 | throw new RuntimeException("ClassMetadataInfo::setTable() has to be called before defining a one to one relationship."); |
1628 | 1628 | } |
1629 | 1629 | |
1630 | - $this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = array( |
|
1630 | + $this->table['uniqueConstraints'][$mapping['fieldName']."_uniq"] = array( |
|
1631 | 1631 | 'columns' => $uniqueConstraintColumns |
1632 | 1632 | ); |
1633 | 1633 | } |
@@ -1642,7 +1642,7 @@ discard block |
||
1642 | 1642 | unset($mapping['unique']); |
1643 | 1643 | } |
1644 | 1644 | |
1645 | - if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) { |
|
1645 | + if (isset($mapping['id']) && $mapping['id'] === true && ! $mapping['isOwningSide']) { |
|
1646 | 1646 | throw MappingException::illegalInverseIdentifierAssociation($this->name, $mapping['fieldName']); |
1647 | 1647 | } |
1648 | 1648 | |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity'] |
1699 | - && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns']))); |
|
1699 | + && ( ! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns']))); |
|
1700 | 1700 | |
1701 | 1701 | if ( ! isset($mapping['joinTable']['joinColumns'])) { |
1702 | 1702 | $mapping['joinTable']['joinColumns'] = array( |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | |
1886 | 1886 | // Association defined as Id field |
1887 | 1887 | $joinColumns = $this->associationMappings[$idProperty]['joinColumns']; |
1888 | - $assocColumnNames = array_map(function ($joinColumn) { return $joinColumn['name']; }, $joinColumns); |
|
1888 | + $assocColumnNames = array_map(function($joinColumn) { return $joinColumn['name']; }, $joinColumns); |
|
1889 | 1889 | |
1890 | 1890 | $columnNames = array_merge($columnNames, $assocColumnNames); |
1891 | 1891 | } |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | public function getTemporaryIdTableName() |
2067 | 2067 | { |
2068 | 2068 | // replace dots with underscores because PostgreSQL creates temporary tables in a special schema |
2069 | - return str_replace('.', '_', $this->getTableName() . '_id_tmp'); |
|
2069 | + return str_replace('.', '_', $this->getTableName().'_id_tmp'); |
|
2070 | 2070 | } |
2071 | 2071 | |
2072 | 2072 | /** |
@@ -2395,7 +2395,7 @@ discard block |
||
2395 | 2395 | */ |
2396 | 2396 | public function addNamedQuery(array $queryMapping) |
2397 | 2397 | { |
2398 | - if (!isset($queryMapping['name'])) { |
|
2398 | + if ( ! isset($queryMapping['name'])) { |
|
2399 | 2399 | throw MappingException::nameIsMandatoryForQueryMapping($this->name); |
2400 | 2400 | } |
2401 | 2401 | |
@@ -2403,7 +2403,7 @@ discard block |
||
2403 | 2403 | throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']); |
2404 | 2404 | } |
2405 | 2405 | |
2406 | - if (!isset($queryMapping['query'])) { |
|
2406 | + if ( ! isset($queryMapping['query'])) { |
|
2407 | 2407 | throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']); |
2408 | 2408 | } |
2409 | 2409 | |
@@ -2430,7 +2430,7 @@ discard block |
||
2430 | 2430 | */ |
2431 | 2431 | public function addNamedNativeQuery(array $queryMapping) |
2432 | 2432 | { |
2433 | - if (!isset($queryMapping['name'])) { |
|
2433 | + if ( ! isset($queryMapping['name'])) { |
|
2434 | 2434 | throw MappingException::nameIsMandatoryForQueryMapping($this->name); |
2435 | 2435 | } |
2436 | 2436 | |
@@ -2438,11 +2438,11 @@ discard block |
||
2438 | 2438 | throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']); |
2439 | 2439 | } |
2440 | 2440 | |
2441 | - if (!isset($queryMapping['query'])) { |
|
2441 | + if ( ! isset($queryMapping['query'])) { |
|
2442 | 2442 | throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']); |
2443 | 2443 | } |
2444 | 2444 | |
2445 | - if (!isset($queryMapping['resultClass']) && !isset($queryMapping['resultSetMapping'])) { |
|
2445 | + if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) { |
|
2446 | 2446 | throw MappingException::missingQueryMapping($this->name, $queryMapping['name']); |
2447 | 2447 | } |
2448 | 2448 | |
@@ -2474,7 +2474,7 @@ discard block |
||
2474 | 2474 | */ |
2475 | 2475 | public function addSqlResultSetMapping(array $resultMapping) |
2476 | 2476 | { |
2477 | - if (!isset($resultMapping['name'])) { |
|
2477 | + if ( ! isset($resultMapping['name'])) { |
|
2478 | 2478 | throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->name); |
2479 | 2479 | } |
2480 | 2480 | |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | |
2485 | 2485 | if (isset($resultMapping['entities'])) { |
2486 | 2486 | foreach ($resultMapping['entities'] as $key => $entityResult) { |
2487 | - if (!isset($entityResult['entityClass'])) { |
|
2487 | + if ( ! isset($entityResult['entityClass'])) { |
|
2488 | 2488 | throw MappingException::missingResultSetMappingEntity($this->name, $resultMapping['name']); |
2489 | 2489 | } |
2490 | 2490 | |
@@ -2503,11 +2503,11 @@ discard block |
||
2503 | 2503 | |
2504 | 2504 | if (isset($entityResult['fields'])) { |
2505 | 2505 | foreach ($entityResult['fields'] as $k => $field) { |
2506 | - if (!isset($field['name'])) { |
|
2506 | + if ( ! isset($field['name'])) { |
|
2507 | 2507 | throw MappingException::missingResultSetMappingFieldName($this->name, $resultMapping['name']); |
2508 | 2508 | } |
2509 | 2509 | |
2510 | - if (!isset($field['column'])) { |
|
2510 | + if ( ! isset($field['column'])) { |
|
2511 | 2511 | $fieldName = $field['name']; |
2512 | 2512 | if (strpos($fieldName, '.')) { |
2513 | 2513 | list(, $fieldName) = explode('.', $fieldName); |
@@ -2998,7 +2998,7 @@ discard block |
||
2998 | 2998 | } |
2999 | 2999 | |
3000 | 3000 | if ($definition['sequenceName'][0] == '`') { |
3001 | - $definition['sequenceName'] = trim($definition['sequenceName'], '`'); |
|
3001 | + $definition['sequenceName'] = trim($definition['sequenceName'], '`'); |
|
3002 | 3002 | $definition['quoted'] = true; |
3003 | 3003 | } |
3004 | 3004 | |
@@ -3090,7 +3090,7 @@ discard block |
||
3090 | 3090 | public function getAssociationTargetClass($assocName) |
3091 | 3091 | { |
3092 | 3092 | if ( ! isset($this->associationMappings[$assocName])) { |
3093 | - throw new InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association."); |
|
3093 | + throw new InvalidArgumentException("Association name expected, '".$assocName."' is not an association."); |
|
3094 | 3094 | } |
3095 | 3095 | |
3096 | 3096 | return $this->associationMappings[$assocName]['targetEntity']; |
@@ -3129,7 +3129,7 @@ discard block |
||
3129 | 3129 | // Association defined as Id field |
3130 | 3130 | $joinColumns = $this->associationMappings[$idProperty]['joinColumns']; |
3131 | 3131 | $assocQuotedColumnNames = array_map( |
3132 | - function ($joinColumn) use ($platform) { |
|
3132 | + function($joinColumn) use ($platform) { |
|
3133 | 3133 | return isset($joinColumn['quoted']) |
3134 | 3134 | ? $platform->quoteIdentifier($joinColumn['name']) |
3135 | 3135 | : $joinColumn['name']; |
@@ -3240,7 +3240,7 @@ discard block |
||
3240 | 3240 | } |
3241 | 3241 | |
3242 | 3242 | if ($className !== null && strpos($className, '\\') === false && $this->namespace) { |
3243 | - return $this->namespace . '\\' . $className; |
|
3243 | + return $this->namespace.'\\'.$className; |
|
3244 | 3244 | } |
3245 | 3245 | |
3246 | 3246 | return $className; |
@@ -3294,15 +3294,15 @@ discard block |
||
3294 | 3294 | ? $fieldMapping['originalClass'] |
3295 | 3295 | : $embeddable->name; |
3296 | 3296 | $fieldMapping['declaredField'] = isset($fieldMapping['declaredField']) |
3297 | - ? $property . '.' . $fieldMapping['declaredField'] |
|
3297 | + ? $property.'.'.$fieldMapping['declaredField'] |
|
3298 | 3298 | : $property; |
3299 | 3299 | $fieldMapping['originalField'] = isset($fieldMapping['originalField']) |
3300 | 3300 | ? $fieldMapping['originalField'] |
3301 | 3301 | : $fieldMapping['fieldName']; |
3302 | - $fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName']; |
|
3302 | + $fieldMapping['fieldName'] = $property.".".$fieldMapping['fieldName']; |
|
3303 | 3303 | |
3304 | - if (! empty($this->embeddedClasses[$property]['columnPrefix'])) { |
|
3305 | - $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName']; |
|
3304 | + if ( ! empty($this->embeddedClasses[$property]['columnPrefix'])) { |
|
3305 | + $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'].$fieldMapping['columnName']; |
|
3306 | 3306 | } elseif ($this->embeddedClasses[$property]['columnPrefix'] !== false) { |
3307 | 3307 | $fieldMapping['columnName'] = $this->namingStrategy |
3308 | 3308 | ->embeddedFieldToColumnName( |
@@ -3343,7 +3343,7 @@ discard block |
||
3343 | 3343 | { |
3344 | 3344 | $sequencePrefix = $this->getSequencePrefix($platform); |
3345 | 3345 | $columnName = $this->getSingleIdentifierColumnName(); |
3346 | - $sequenceName = $sequencePrefix . '_' . $columnName . '_seq'; |
|
3346 | + $sequenceName = $sequencePrefix.'_'.$columnName.'_seq'; |
|
3347 | 3347 | |
3348 | 3348 | return $sequenceName; |
3349 | 3349 | } |
@@ -3363,10 +3363,10 @@ discard block |
||
3363 | 3363 | |
3364 | 3364 | // Prepend the schema name to the table name if there is one |
3365 | 3365 | if ($schemaName = $this->getSchemaName()) { |
3366 | - $sequencePrefix = $schemaName . '.' . $tableName; |
|
3366 | + $sequencePrefix = $schemaName.'.'.$tableName; |
|
3367 | 3367 | |
3368 | 3368 | if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) { |
3369 | - $sequencePrefix = $schemaName . '__' . $tableName; |
|
3369 | + $sequencePrefix = $schemaName.'__'.$tableName; |
|
3370 | 3370 | } |
3371 | 3371 | } |
3372 | 3372 | |
@@ -3378,8 +3378,8 @@ discard block |
||
3378 | 3378 | */ |
3379 | 3379 | private function assertMappingOrderBy(array $mapping) |
3380 | 3380 | { |
3381 | - if (isset($mapping['orderBy']) && !is_array($mapping['orderBy'])) { |
|
3382 | - throw new InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy'])); |
|
3381 | + if (isset($mapping['orderBy']) && ! is_array($mapping['orderBy'])) { |
|
3382 | + throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy'])); |
|
3383 | 3383 | } |
3384 | 3384 | } |
3385 | 3385 | } |