@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | if ($this->count === null) { |
122 | 122 | try { |
123 | 123 | $this->count = array_sum(array_map('current', $this->getCountQuery()->getScalarResult())); |
124 | - } catch(NoResultException $e) { |
|
124 | + } catch (NoResultException $e) { |
|
125 | 125 | $this->count = 0; |
126 | 126 | } |
127 | 127 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | foreach ($parameters as $key => $parameter) { |
268 | 268 | $parameterName = $parameter->getName(); |
269 | 269 | |
270 | - if( ! (isset($parameterMappings[$parameterName]) || array_key_exists($parameterName, $parameterMappings))) { |
|
270 | + if ( ! (isset($parameterMappings[$parameterName]) || array_key_exists($parameterName, $parameterMappings))) { |
|
271 | 271 | unset($parameters[$key]); |
272 | 272 | } |
273 | 273 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function exportClassMetadata(ClassMetadataInfo $metadata) |
42 | 42 | { |
43 | 43 | $xml = new \SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><doctrine-mapping ". |
44 | - "xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" " . |
|
44 | + "xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" ". |
|
45 | 45 | "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ". |
46 | 46 | "xsi:schemaLocation=\"http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd\" />"); |
47 | 47 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $trackingPolicy = $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy); |
99 | 99 | |
100 | - if ( $trackingPolicy != 'DEFERRED_IMPLICIT') { |
|
100 | + if ($trackingPolicy != 'DEFERRED_IMPLICIT') { |
|
101 | 101 | $root->addChild('change-tracking-policy', $trackingPolicy); |
102 | 102 | } |
103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $indexXml = $indexesXml->addChild('index'); |
109 | 109 | $indexXml->addAttribute('name', $name); |
110 | 110 | $indexXml->addAttribute('columns', implode(',', $index['columns'])); |
111 | - if(isset($index['flags'])) { |
|
111 | + if (isset($index['flags'])) { |
|
112 | 112 | $indexXml->addAttribute('flags', implode(',', $index['flags'])); |
113 | 113 | } |
114 | 114 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | if (count($cascade) === 5) { |
298 | - $cascade = array('cascade-all'); |
|
298 | + $cascade = array('cascade-all'); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | if ($cascade) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | - if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks)>0) { |
|
380 | + if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks) > 0) { |
|
381 | 381 | $lifecycleCallbacksXml = $root->addChild('lifecycle-callbacks'); |
382 | 382 | |
383 | 383 | foreach ($metadata->lifecycleCallbacks as $name => $methods) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | { |
427 | 427 | $sequenceDefinition = $metadata->sequenceGeneratorDefinition; |
428 | 428 | |
429 | - if (! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { |
|
429 | + if ( ! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { |
|
430 | 430 | return; |
431 | 431 | } |
432 | 432 |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | |
136 | 136 | foreach ($this->_metadata as $metadata) { |
137 | 137 | // In case output is returned, write it to a file, skip otherwise |
138 | - if($output = $this->exportClassMetadata($metadata)){ |
|
138 | + if ($output = $this->exportClassMetadata($metadata)) { |
|
139 | 139 | $path = $this->_generateOutputPath($metadata); |
140 | 140 | $dir = dirname($path); |
141 | 141 | if ( ! is_dir($dir)) { |
142 | 142 | mkdir($dir, 0775, true); |
143 | 143 | } |
144 | - if (file_exists($path) && !$this->_overwriteExistingFiles) { |
|
144 | + if (file_exists($path) && ! $this->_overwriteExistingFiles) { |
|
145 | 145 | throw ExportException::attemptOverwriteExistingFile($path); |
146 | 146 | } |
147 | 147 | file_put_contents($path, $output); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | protected function _generateOutputPath(ClassMetadataInfo $metadata) |
161 | 161 | { |
162 | - return $this->_outputDir . '/' . str_replace('\\', '.', $metadata->name) . $this->_extension; |
|
162 | + return $this->_outputDir.'/'.str_replace('\\', '.', $metadata->name).$this->_extension; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $inheritedKeyColumns[] = $columnName; |
223 | 223 | } |
224 | 224 | } |
225 | - if (!empty($inheritedKeyColumns)) { |
|
225 | + if ( ! empty($inheritedKeyColumns)) { |
|
226 | 226 | // Add a FK constraint on the ID column |
227 | 227 | $table->addForeignKeyConstraint( |
228 | 228 | $this->quoteStrategy->getTableName( |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | |
266 | 266 | if (isset($class->table['indexes'])) { |
267 | 267 | foreach ($class->table['indexes'] as $indexName => $indexData) { |
268 | - if( ! isset($indexData['flags'])) { |
|
268 | + if ( ! isset($indexData['flags'])) { |
|
269 | 269 | $indexData['flags'] = array(); |
270 | 270 | } |
271 | 271 | |
272 | - $table->addIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName, (array)$indexData['flags'], isset($indexData['options']) ? $indexData['options'] : array()); |
|
272 | + $table->addIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName, (array) $indexData['flags'], isset($indexData['options']) ? $indexData['options'] : array()); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
319 | - if ( ! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas() ) { |
|
319 | + if ( ! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas()) { |
|
320 | 320 | $schema->visit(new RemoveNamespacedAssets()); |
321 | 321 | } |
322 | 322 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | // For now, this is a hack required for single table inheritence, since this method is called |
392 | 392 | // twice by single table inheritence relations |
393 | - if (!$table->hasIndex('primary')) { |
|
393 | + if ( ! $table->hasIndex('primary')) { |
|
394 | 394 | //$table->setPrimaryKey($pkColumns); |
395 | 395 | } |
396 | 396 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | if ( ! $definingClass) { |
627 | 627 | throw new \Doctrine\ORM\ORMException( |
628 | 628 | "Column name `".$joinColumn['referencedColumnName']."` referenced for relation from ". |
629 | - $mapping['sourceEntity'] . " towards ". $mapping['targetEntity'] . " does not exist." |
|
629 | + $mapping['sourceEntity']." towards ".$mapping['targetEntity']." does not exist." |
|
630 | 630 | ); |
631 | 631 | } |
632 | 632 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $columnOptions = array('notnull' => false, 'columnDefinition' => $columnDef); |
659 | 659 | |
660 | 660 | if (isset($joinColumn['nullable'])) { |
661 | - $columnOptions['notnull'] = !$joinColumn['nullable']; |
|
661 | + $columnOptions['notnull'] = ! $joinColumn['nullable']; |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | if (isset($fieldMapping['options'])) { |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | } |
706 | 706 | } |
707 | 707 | $blacklistedFks[$compositeName] = true; |
708 | - } elseif (!isset($blacklistedFks[$compositeName])) { |
|
708 | + } elseif ( ! isset($blacklistedFks[$compositeName])) { |
|
709 | 709 | $addedFks[$compositeName] = array('foreignTableName' => $foreignTableName, 'foreignColumns' => $foreignColumns); |
710 | 710 | $theJoinTable->addUnnamedForeignKeyConstraint( |
711 | 711 | $foreignTableName, |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | if ($table->hasPrimaryKey()) { |
813 | 813 | $columns = $table->getPrimaryKey()->getColumns(); |
814 | 814 | if (count($columns) == 1) { |
815 | - $checkSequence = $table->getName() . "_" . $columns[0] . "_seq"; |
|
815 | + $checkSequence = $table->getName()."_".$columns[0]."_seq"; |
|
816 | 816 | if ($fullSchema->hasSequence($checkSequence)) { |
817 | 817 | $visitor->acceptSequence($fullSchema->getSequence($checkSequence)); |
818 | 818 | } |
@@ -110,12 +110,12 @@ |
||
110 | 110 | |
111 | 111 | if ($numRepositories) { |
112 | 112 | // Outputting information message |
113 | - $output->writeln(PHP_EOL . sprintf('Repository classes generated to "<info>%s</INFO>"', $destPath) ); |
|
113 | + $output->writeln(PHP_EOL.sprintf('Repository classes generated to "<info>%s</INFO>"', $destPath)); |
|
114 | 114 | } else { |
115 | - $output->writeln('No Repository classes were found to be processed.' ); |
|
115 | + $output->writeln('No Repository classes were found to be processed.'); |
|
116 | 116 | } |
117 | 117 | } else { |
118 | - $output->writeln('No Metadata Classes to process.' ); |
|
118 | + $output->writeln('No Metadata Classes to process.'); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ->addArgument('entity-class', InputArgument::OPTIONAL, 'The entity name.') |
47 | 47 | ->addArgument('entity-id', InputArgument::OPTIONAL, 'The entity identifier.') |
48 | 48 | ->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all entity regions will be deleted/invalidated.') |
49 | - ->addOption('flush', null, InputOption::VALUE_NONE,'If defined, all cache entries will be flushed.'); |
|
49 | + ->addOption('flush', null, InputOption::VALUE_NONE, 'If defined, all cache entries will be flushed.'); |
|
50 | 50 | |
51 | 51 | |
52 | 52 | $this->setHelp(<<<EOT |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | if ($input->getOption('flush')) { |
98 | - $entityRegion = $cache->getEntityCacheRegion($entityClass); |
|
98 | + $entityRegion = $cache->getEntityCacheRegion($entityClass); |
|
99 | 99 | |
100 | 100 | if ( ! $entityRegion instanceof DefaultRegion) { |
101 | 101 | throw new \InvalidArgumentException(sprintf( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ->addArgument('association', InputArgument::OPTIONAL, 'The association collection name.') |
48 | 48 | ->addArgument('owner-id', InputArgument::OPTIONAL, 'The owner identifier.') |
49 | 49 | ->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all entity regions will be deleted/invalidated.') |
50 | - ->addOption('flush', null, InputOption::VALUE_NONE,'If defined, all cache entries will be flushed.'); |
|
50 | + ->addOption('flush', null, InputOption::VALUE_NONE, 'If defined, all cache entries will be flushed.'); |
|
51 | 51 | |
52 | 52 | |
53 | 53 | $this->setHelp(<<<EOT |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | throw new \InvalidArgumentException('No second-level cache is configured on the given EntityManager.'); |
93 | 93 | } |
94 | 94 | |
95 | - if ( (! $ownerClass || ! $assoc) && ! $input->getOption('all')) { |
|
95 | + if (( ! $ownerClass || ! $assoc) && ! $input->getOption('all')) { |
|
96 | 96 | throw new \InvalidArgumentException('Missing arguments "--owner-class" "--association"'); |
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($input->getOption('flush')) { |
100 | - $collectionRegion = $cache->getCollectionCacheRegion($ownerClass, $assoc); |
|
100 | + $collectionRegion = $cache->getCollectionCacheRegion($ownerClass, $assoc); |
|
101 | 101 | |
102 | 102 | if ( ! $collectionRegion instanceof DefaultRegion) { |
103 | 103 | throw new \InvalidArgumentException(sprintf( |
@@ -45,7 +45,7 @@ |
||
45 | 45 | ->setDescription('Clear a second-level cache query region.') |
46 | 46 | ->addArgument('region-name', InputArgument::OPTIONAL, 'The query region to clear.') |
47 | 47 | ->addOption('all', null, InputOption::VALUE_NONE, 'If defined, all query regions will be deleted/invalidated.') |
48 | - ->addOption('flush', null, InputOption::VALUE_NONE,'If defined, all cache entries will be flushed.'); |
|
48 | + ->addOption('flush', null, InputOption::VALUE_NONE, 'If defined, all cache entries will be flushed.'); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | $this->setHelp(<<<EOT |
@@ -89,80 +89,80 @@ discard block |
||
89 | 89 | $cmf = $this->em->getMetadataFactory(); |
90 | 90 | |
91 | 91 | foreach ($class->fieldMappings as $fieldName => $mapping) { |
92 | - if (!Type::hasType($mapping['type'])) { |
|
93 | - $ce[] = "The field '" . $class->name . "#" . $fieldName."' uses a non-existant type '" . $mapping['type'] . "'."; |
|
92 | + if ( ! Type::hasType($mapping['type'])) { |
|
93 | + $ce[] = "The field '".$class->name."#".$fieldName."' uses a non-existant type '".$mapping['type']."'."; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | 97 | foreach ($class->associationMappings as $fieldName => $assoc) { |
98 | - if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { |
|
99 | - $ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.'; |
|
98 | + if ( ! class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { |
|
99 | + $ce[] = "The target entity '".$assoc['targetEntity']."' specified on ".$class->name.'#'.$fieldName.' is unknown or not an entity.'; |
|
100 | 100 | return $ce; |
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($assoc['mappedBy'] && $assoc['inversedBy']) { |
104 | - $ce[] = "The association " . $class . "#" . $fieldName . " cannot be defined as both inverse and owning."; |
|
104 | + $ce[] = "The association ".$class."#".$fieldName." cannot be defined as both inverse and owning."; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $targetMetadata = $cmf->getMetadataFor($assoc['targetEntity']); |
108 | 108 | |
109 | 109 | if (isset($assoc['id']) && $targetMetadata->containsForeignIdentifier) { |
110 | - $ce[] = "Cannot map association '" . $class->name. "#". $fieldName ." as identifier, because " . |
|
111 | - "the target entity '". $targetMetadata->name . "' also maps an association as identifier."; |
|
110 | + $ce[] = "Cannot map association '".$class->name."#".$fieldName." as identifier, because ". |
|
111 | + "the target entity '".$targetMetadata->name."' also maps an association as identifier."; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($assoc['mappedBy']) { |
115 | 115 | if ($targetMetadata->hasField($assoc['mappedBy'])) { |
116 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ". |
|
117 | - "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which is not defined as association, but as field."; |
|
116 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ". |
|
117 | + "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which is not defined as association, but as field."; |
|
118 | 118 | } |
119 | - if (!$targetMetadata->hasAssociation($assoc['mappedBy'])) { |
|
120 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ". |
|
121 | - "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which does not exist."; |
|
119 | + if ( ! $targetMetadata->hasAssociation($assoc['mappedBy'])) { |
|
120 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ". |
|
121 | + "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which does not exist."; |
|
122 | 122 | } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] == null) { |
123 | - $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the inverse side of a ". |
|
123 | + $ce[] = "The field ".$class->name."#".$fieldName." is on the inverse side of a ". |
|
124 | 124 | "bi-directional relationship, but the specified mappedBy association on the target-entity ". |
125 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ". |
|
126 | - "'inversedBy=\"" . $fieldName . "\"' attribute."; |
|
125 | + $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ". |
|
126 | + "'inversedBy=\"".$fieldName."\"' attribute."; |
|
127 | 127 | } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] != $fieldName) { |
128 | - $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " . |
|
129 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " are ". |
|
128 | + $ce[] = "The mappings ".$class->name."#".$fieldName." and ". |
|
129 | + $assoc['targetEntity']."#".$assoc['mappedBy']." are ". |
|
130 | 130 | "inconsistent with each other."; |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | if ($assoc['inversedBy']) { |
135 | 135 | if ($targetMetadata->hasField($assoc['inversedBy'])) { |
136 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ". |
|
137 | - "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which is not defined as association."; |
|
136 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ". |
|
137 | + "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which is not defined as association."; |
|
138 | 138 | } |
139 | 139 | |
140 | - if (!$targetMetadata->hasAssociation($assoc['inversedBy'])) { |
|
141 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ". |
|
142 | - "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which does not exist."; |
|
140 | + if ( ! $targetMetadata->hasAssociation($assoc['inversedBy'])) { |
|
141 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ". |
|
142 | + "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which does not exist."; |
|
143 | 143 | } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] == null) { |
144 | - $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the owning side of a ". |
|
144 | + $ce[] = "The field ".$class->name."#".$fieldName." is on the owning side of a ". |
|
145 | 145 | "bi-directional relationship, but the specified mappedBy association on the target-entity ". |
146 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ". |
|
146 | + $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ". |
|
147 | 147 | "'inversedBy' attribute."; |
148 | 148 | } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] != $fieldName) { |
149 | - $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " . |
|
150 | - $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " are ". |
|
149 | + $ce[] = "The mappings ".$class->name."#".$fieldName." and ". |
|
150 | + $assoc['targetEntity']."#".$assoc['inversedBy']." are ". |
|
151 | 151 | "inconsistent with each other."; |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Verify inverse side/owning side match each other |
155 | 155 | if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) { |
156 | 156 | $targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']]; |
157 | - if ($assoc['type'] == ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE){ |
|
158 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is one-to-one, then the inversed " . |
|
159 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-one as well."; |
|
160 | - } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY){ |
|
161 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-one, then the inversed " . |
|
162 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-many."; |
|
163 | - } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY){ |
|
164 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-many, then the inversed " . |
|
165 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be many-to-many as well."; |
|
157 | + if ($assoc['type'] == ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE) { |
|
158 | + $ce[] = "If association ".$class->name."#".$fieldName." is one-to-one, then the inversed ". |
|
159 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-one as well."; |
|
160 | + } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY) { |
|
161 | + $ce[] = "If association ".$class->name."#".$fieldName." is many-to-one, then the inversed ". |
|
162 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-many."; |
|
163 | + } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) { |
|
164 | + $ce[] = "If association ".$class->name."#".$fieldName." is many-to-many, then the inversed ". |
|
165 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be many-to-many as well."; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | if ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY) { |
172 | 172 | $identifierColumns = $class->getIdentifierColumnNames(); |
173 | 173 | foreach ($assoc['joinTable']['joinColumns'] as $joinColumn) { |
174 | - if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
175 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
174 | + if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
175 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
176 | 176 | "has to be a primary key column on the target entity class '".$class->name."'."; |
177 | 177 | break; |
178 | 178 | } |
@@ -180,32 +180,32 @@ discard block |
||
180 | 180 | |
181 | 181 | $identifierColumns = $targetMetadata->getIdentifierColumnNames(); |
182 | 182 | foreach ($assoc['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) { |
183 | - if (!in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) { |
|
184 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
183 | + if ( ! in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) { |
|
184 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
185 | 185 | "has to be a primary key column on the target entity class '".$targetMetadata->name."'."; |
186 | 186 | break; |
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | 190 | if (count($targetMetadata->getIdentifierColumnNames()) != count($assoc['joinTable']['inverseJoinColumns'])) { |
191 | - $ce[] = "The inverse join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " . |
|
192 | - "have to contain to ALL identifier columns of the target entity '". $targetMetadata->name . "', " . |
|
193 | - "however '" . implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), array_values($assoc['relationToTargetKeyColumns']))) . |
|
191 | + $ce[] = "The inverse join columns of the many-to-many table '".$assoc['joinTable']['name']."' ". |
|
192 | + "have to contain to ALL identifier columns of the target entity '".$targetMetadata->name."', ". |
|
193 | + "however '".implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), array_values($assoc['relationToTargetKeyColumns']))). |
|
194 | 194 | "' are missing."; |
195 | 195 | } |
196 | 196 | |
197 | 197 | if (count($class->getIdentifierColumnNames()) != count($assoc['joinTable']['joinColumns'])) { |
198 | - $ce[] = "The join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " . |
|
199 | - "have to contain to ALL identifier columns of the source entity '". $class->name . "', " . |
|
200 | - "however '" . implode(", ", array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))) . |
|
198 | + $ce[] = "The join columns of the many-to-many table '".$assoc['joinTable']['name']."' ". |
|
199 | + "have to contain to ALL identifier columns of the source entity '".$class->name."', ". |
|
200 | + "however '".implode(", ", array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))). |
|
201 | 201 | "' are missing."; |
202 | 202 | } |
203 | 203 | |
204 | 204 | } elseif ($assoc['type'] & ClassMetadataInfo::TO_ONE) { |
205 | 205 | $identifierColumns = $targetMetadata->getIdentifierColumnNames(); |
206 | 206 | foreach ($assoc['joinColumns'] as $joinColumn) { |
207 | - if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
208 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
207 | + if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
208 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
209 | 209 | "has to be a primary key column on the target entity class '".$targetMetadata->name."'."; |
210 | 210 | } |
211 | 211 | } |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | $ids[] = $joinColumn['name']; |
218 | 218 | } |
219 | 219 | |
220 | - $ce[] = "The join columns of the association '" . $assoc['fieldName'] . "' " . |
|
221 | - "have to match to ALL identifier columns of the target entity '". $targetMetadata->name . "', " . |
|
222 | - "however '" . implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), $ids)) . |
|
220 | + $ce[] = "The join columns of the association '".$assoc['fieldName']."' ". |
|
221 | + "have to match to ALL identifier columns of the target entity '".$targetMetadata->name."', ". |
|
222 | + "however '".implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), $ids)). |
|
223 | 223 | "' are missing."; |
224 | 224 | } |
225 | 225 | } |
@@ -227,19 +227,19 @@ discard block |
||
227 | 227 | |
228 | 228 | if (isset($assoc['orderBy']) && $assoc['orderBy'] !== null) { |
229 | 229 | foreach ($assoc['orderBy'] as $orderField => $orientation) { |
230 | - if (!$targetMetadata->hasField($orderField) && !$targetMetadata->hasAssociation($orderField)) { |
|
231 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a foreign field " . |
|
232 | - $orderField . " that is not a field on the target entity " . $targetMetadata->name . "."; |
|
230 | + if ( ! $targetMetadata->hasField($orderField) && ! $targetMetadata->hasAssociation($orderField)) { |
|
231 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a foreign field ". |
|
232 | + $orderField." that is not a field on the target entity ".$targetMetadata->name."."; |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | if ($targetMetadata->isCollectionValuedAssociation($orderField)) { |
236 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " . |
|
237 | - $orderField . " on " . $targetMetadata->name . " that is a collection-valued association."; |
|
236 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ". |
|
237 | + $orderField." on ".$targetMetadata->name." that is a collection-valued association."; |
|
238 | 238 | continue; |
239 | 239 | } |
240 | 240 | if ($targetMetadata->isAssociationInverseSide($orderField)) { |
241 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " . |
|
242 | - $orderField . " on " . $targetMetadata->name . " that is the inverse side of an association."; |
|
241 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ". |
|
242 | + $orderField." on ".$targetMetadata->name." that is the inverse side of an association."; |
|
243 | 243 | continue; |
244 | 244 | } |
245 | 245 | } |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | foreach ($class->subClasses as $subClass) { |
250 | - if (!in_array($class->name, class_parents($subClass))) { |
|
251 | - $ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ". |
|
252 | - "of '" . $class->name . "' but these entities are not related through inheritance."; |
|
250 | + if ( ! in_array($class->name, class_parents($subClass))) { |
|
251 | + $ce[] = "According to the discriminator map class '".$subClass."' has to be a child ". |
|
252 | + "of '".$class->name."' but these entities are not related through inheritance."; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 |