Completed
Push — 2.6 ( c2f698...3f772e )
by Luís
52s queued 46s
created
lib/Doctrine/ORM/Tools/SchemaValidator.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -89,66 +89,66 @@  discard block
 block discarded – undo
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-existent type '" . $mapping['type'] . "'.";
92
+            if ( ! Type::hasType($mapping['type'])) {
93
+                $ce[] = "The field '".$class->name."#".$fieldName."' uses a non-existent 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
 
101 101
                 return $ce;
102 102
             }
103 103
 
104 104
             if ($assoc['mappedBy'] && $assoc['inversedBy']) {
105
-                $ce[] = "The association " . $class . "#" . $fieldName . " cannot be defined as both inverse and owning.";
105
+                $ce[] = "The association ".$class."#".$fieldName." cannot be defined as both inverse and owning.";
106 106
             }
107 107
 
108 108
             $targetMetadata = $cmf->getMetadataFor($assoc['targetEntity']);
109 109
 
110 110
             if (isset($assoc['id']) && $targetMetadata->containsForeignIdentifier) {
111
-                $ce[] = "Cannot map association '" . $class->name. "#". $fieldName ." as identifier, because " .
112
-                        "the target entity '". $targetMetadata->name . "' also maps an association as identifier.";
111
+                $ce[] = "Cannot map association '".$class->name."#".$fieldName." as identifier, because ".
112
+                        "the target entity '".$targetMetadata->name."' also maps an association as identifier.";
113 113
             }
114 114
 
115 115
             if ($assoc['mappedBy']) {
116 116
                 if ($targetMetadata->hasField($assoc['mappedBy'])) {
117
-                    $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ".
118
-                            "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which is not defined as association, but as field.";
117
+                    $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ".
118
+                            "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which is not defined as association, but as field.";
119 119
                 }
120
-                if (!$targetMetadata->hasAssociation($assoc['mappedBy'])) {
121
-                    $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ".
122
-                            "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which does not exist.";
120
+                if ( ! $targetMetadata->hasAssociation($assoc['mappedBy'])) {
121
+                    $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ".
122
+                            "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which does not exist.";
123 123
                 } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] == null) {
124
-                    $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the inverse side of a ".
124
+                    $ce[] = "The field ".$class->name."#".$fieldName." is on the inverse side of a ".
125 125
                             "bi-directional relationship, but the specified mappedBy association on the target-entity ".
126
-                            $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ".
127
-                            "'inversedBy=\"" . $fieldName . "\"' attribute.";
126
+                            $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ".
127
+                            "'inversedBy=\"".$fieldName."\"' attribute.";
128 128
                 } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] != $fieldName) {
129
-                    $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " .
130
-                            $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " are ".
129
+                    $ce[] = "The mappings ".$class->name."#".$fieldName." and ".
130
+                            $assoc['targetEntity']."#".$assoc['mappedBy']." are ".
131 131
                             "inconsistent with each other.";
132 132
                 }
133 133
             }
134 134
 
135 135
             if ($assoc['inversedBy']) {
136 136
                 if ($targetMetadata->hasField($assoc['inversedBy'])) {
137
-                    $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ".
138
-                            "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which is not defined as association.";
137
+                    $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ".
138
+                            "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which is not defined as association.";
139 139
                 }
140 140
 
141
-                if (!$targetMetadata->hasAssociation($assoc['inversedBy'])) {
142
-                    $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ".
143
-                            "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which does not exist.";
141
+                if ( ! $targetMetadata->hasAssociation($assoc['inversedBy'])) {
142
+                    $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ".
143
+                            "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which does not exist.";
144 144
                 } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] == null) {
145
-                    $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the owning side of a ".
145
+                    $ce[] = "The field ".$class->name."#".$fieldName." is on the owning side of a ".
146 146
                             "bi-directional relationship, but the specified mappedBy association on the target-entity ".
147
-                            $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ".
147
+                            $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ".
148 148
                             "'inversedBy' attribute.";
149 149
                 } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] != $fieldName) {
150
-                    $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " .
151
-                            $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " are ".
150
+                    $ce[] = "The mappings ".$class->name."#".$fieldName." and ".
151
+                            $assoc['targetEntity']."#".$assoc['inversedBy']." are ".
152 152
                             "inconsistent with each other.";
153 153
                 }
154 154
 
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
                 if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) {
157 157
                     $targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']];
158 158
                     if ($assoc['type'] == ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE) {
159
-                        $ce[] = "If association " . $class->name . "#" . $fieldName . " is one-to-one, then the inversed " .
160
-                                "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-one as well.";
159
+                        $ce[] = "If association ".$class->name."#".$fieldName." is one-to-one, then the inversed ".
160
+                                "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-one as well.";
161 161
                     } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
162
-                        $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-one, then the inversed " .
163
-                                "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-many.";
162
+                        $ce[] = "If association ".$class->name."#".$fieldName." is many-to-one, then the inversed ".
163
+                                "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-many.";
164 164
                     } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) {
165
-                        $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-many, then the inversed " .
166
-                                "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be many-to-many as well.";
165
+                        $ce[] = "If association ".$class->name."#".$fieldName." is many-to-many, then the inversed ".
166
+                                "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be many-to-many as well.";
167 167
                     }
168 168
                 }
169 169
             }
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
                 if ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY) {
173 173
                     $identifierColumns = $class->getIdentifierColumnNames();
174 174
                     foreach ($assoc['joinTable']['joinColumns'] as $joinColumn) {
175
-                        if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) {
176
-                            $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " .
175
+                        if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) {
176
+                            $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ".
177 177
                                 "has to be a primary key column on the target entity class '".$class->name."'.";
178 178
                             break;
179 179
                         }
@@ -181,32 +181,32 @@  discard block
 block discarded – undo
181 181
 
182 182
                     $identifierColumns = $targetMetadata->getIdentifierColumnNames();
183 183
                     foreach ($assoc['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) {
184
-                        if (! in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) {
185
-                            $ce[] = "The referenced column name '" . $inverseJoinColumn['referencedColumnName'] . "' " .
186
-                                "has to be a primary key column on the target entity class '" .$targetMetadata->name . "'.";
184
+                        if ( ! in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) {
185
+                            $ce[] = "The referenced column name '".$inverseJoinColumn['referencedColumnName']."' ".
186
+                                "has to be a primary key column on the target entity class '".$targetMetadata->name."'.";
187 187
                             break;
188 188
                         }
189 189
                     }
190 190
 
191 191
                     if (count($targetMetadata->getIdentifierColumnNames()) != count($assoc['joinTable']['inverseJoinColumns'])) {
192
-                        $ce[] = "The inverse join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " .
193
-                                "have to contain to ALL identifier columns of the target entity '". $targetMetadata->name . "', " .
194
-                                "however '" . implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), array_values($assoc['relationToTargetKeyColumns']))) .
192
+                        $ce[] = "The inverse join columns of the many-to-many table '".$assoc['joinTable']['name']."' ".
193
+                                "have to contain to ALL identifier columns of the target entity '".$targetMetadata->name."', ".
194
+                                "however '".implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), array_values($assoc['relationToTargetKeyColumns']))).
195 195
                                 "' are missing.";
196 196
                     }
197 197
 
198 198
                     if (count($class->getIdentifierColumnNames()) != count($assoc['joinTable']['joinColumns'])) {
199
-                        $ce[] = "The join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " .
200
-                                "have to contain to ALL identifier columns of the source entity '". $class->name . "', " .
201
-                                "however '" . implode(", ", array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))) .
199
+                        $ce[] = "The join columns of the many-to-many table '".$assoc['joinTable']['name']."' ".
200
+                                "have to contain to ALL identifier columns of the source entity '".$class->name."', ".
201
+                                "however '".implode(", ", array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))).
202 202
                                 "' are missing.";
203 203
                     }
204 204
 
205 205
                 } elseif ($assoc['type'] & ClassMetadataInfo::TO_ONE) {
206 206
                     $identifierColumns = $targetMetadata->getIdentifierColumnNames();
207 207
                     foreach ($assoc['joinColumns'] as $joinColumn) {
208
-                        if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) {
209
-                            $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " .
208
+                        if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) {
209
+                            $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ".
210 210
                                     "has to be a primary key column on the target entity class '".$targetMetadata->name."'.";
211 211
                         }
212 212
                     }
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
                             $ids[] = $joinColumn['name'];
219 219
                         }
220 220
 
221
-                        $ce[] = "The join columns of the association '" . $assoc['fieldName'] . "' " .
222
-                                "have to match to ALL identifier columns of the target entity '". $targetMetadata->name . "', " .
223
-                                "however '" . implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), $ids)) .
221
+                        $ce[] = "The join columns of the association '".$assoc['fieldName']."' ".
222
+                                "have to match to ALL identifier columns of the target entity '".$targetMetadata->name."', ".
223
+                                "however '".implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), $ids)).
224 224
                                 "' are missing.";
225 225
                     }
226 226
                 }
@@ -228,19 +228,19 @@  discard block
 block discarded – undo
228 228
 
229 229
             if (isset($assoc['orderBy']) && $assoc['orderBy'] !== null) {
230 230
                 foreach ($assoc['orderBy'] as $orderField => $orientation) {
231
-                    if (!$targetMetadata->hasField($orderField) && !$targetMetadata->hasAssociation($orderField)) {
232
-                        $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a foreign field " .
233
-                                $orderField . " that is not a field on the target entity " . $targetMetadata->name . ".";
231
+                    if ( ! $targetMetadata->hasField($orderField) && ! $targetMetadata->hasAssociation($orderField)) {
232
+                        $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a foreign field ".
233
+                                $orderField." that is not a field on the target entity ".$targetMetadata->name.".";
234 234
                         continue;
235 235
                     }
236 236
                     if ($targetMetadata->isCollectionValuedAssociation($orderField)) {
237
-                        $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " .
238
-                                $orderField . " on " . $targetMetadata->name . " that is a collection-valued association.";
237
+                        $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ".
238
+                                $orderField." on ".$targetMetadata->name." that is a collection-valued association.";
239 239
                         continue;
240 240
                     }
241 241
                     if ($targetMetadata->isAssociationInverseSide($orderField)) {
242
-                        $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " .
243
-                                $orderField . " on " . $targetMetadata->name . " that is the inverse side of an association.";
242
+                        $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ".
243
+                                $orderField." on ".$targetMetadata->name." that is the inverse side of an association.";
244 244
                         continue;
245 245
                     }
246 246
                 }
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
         }
249 249
 
250 250
         foreach ($class->subClasses as $subClass) {
251
-            if (!in_array($class->name, class_parents($subClass))) {
252
-                $ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ".
253
-                        "of '" . $class->name . "' but these entities are not related through inheritance.";
251
+            if ( ! in_array($class->name, class_parents($subClass))) {
252
+                $ce[] = "According to the discriminator map class '".$subClass."' has to be a child ".
253
+                        "of '".$class->name."' but these entities are not related through inheritance.";
254 254
             }
255 255
         }
256 256
 
Please login to merge, or discard this patch.