@@ -20,10 +20,8 @@ |
||
20 | 20 | namespace Doctrine\ORM\Query\Exec; |
21 | 21 | |
22 | 22 | use Doctrine\DBAL\Connection; |
23 | -use Doctrine\DBAL\Types\Type; |
|
24 | 23 | use Doctrine\ORM\Mapping\ColumnMetadata; |
25 | 24 | use Doctrine\ORM\Query\AST; |
26 | -use Doctrine\ORM\Utility\PersisterHelper; |
|
27 | 25 | |
28 | 26 | /** |
29 | 27 | * Executes the SQL statements for bulk DQL DELETE statements on classes in |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
79 | 79 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 't0', $primaryDqlAlias); |
80 | 80 | |
81 | - $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ')' |
|
82 | - . ' SELECT t0.' . implode(', t0.', array_keys($idColumns)); |
|
81 | + $this->_insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.')' |
|
82 | + . ' SELECT t0.'.implode(', t0.', array_keys($idColumns)); |
|
83 | 83 | |
84 | 84 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias); |
85 | 85 | $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | // 2. Create ID subselect statement used in DELETE ... WHERE ... IN (subselect) |
94 | - $idSubselect = 'SELECT ' . $idColumnNameList . ' FROM ' . $tempTable; |
|
94 | + $idSubselect = 'SELECT '.$idColumnNameList.' FROM '.$tempTable; |
|
95 | 95 | |
96 | 96 | // 3. Create and store DELETE statements |
97 | 97 | $classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses); |
98 | 98 | foreach (array_reverse($classNames) as $className) { |
99 | 99 | $tableName = $quoteStrategy->getTableName($em->getClassMetadata($className), $platform); |
100 | - $this->_sqlStatements[] = 'DELETE FROM ' . $tableName |
|
101 | - . ' WHERE (' . $idColumnNameList . ') IN (' . $idSubselect . ')'; |
|
100 | + $this->_sqlStatements[] = 'DELETE FROM '.$tableName |
|
101 | + . ' WHERE ('.$idColumnNameList.') IN ('.$idSubselect.')'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // 4. Store DDL for temporary identifier table. |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | - $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
120 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
119 | + $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
120 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
121 | 121 | $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
122 | 122 | } |
123 | 123 |
@@ -23,7 +23,6 @@ |
||
23 | 23 | use Doctrine\ORM\Mapping\ColumnMetadata; |
24 | 24 | use Doctrine\ORM\Query\ParameterTypeInferer; |
25 | 25 | use Doctrine\ORM\Query\AST; |
26 | -use Doctrine\ORM\Utility\PersisterHelper; |
|
27 | 26 | |
28 | 27 | /** |
29 | 28 | * Executes the SQL statements for bulk DQL UPDATE statements on classes in |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() |
89 | 89 | $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 't0', $updateClause->aliasIdentificationVariable); |
90 | 90 | |
91 | - $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ')' |
|
92 | - . ' SELECT t0.' . implode(', t0.', array_keys($idColumns)); |
|
91 | + $this->_insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.')' |
|
92 | + . ' SELECT t0.'.implode(', t0.', array_keys($idColumns)); |
|
93 | 93 | |
94 | 94 | $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $updateClause->aliasIdentificationVariable); |
95 | 95 | $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->_insertSql .= $sqlWalker->walkFromClause($fromClause); |
98 | 98 | |
99 | 99 | // 2. Create ID subselect statement used in UPDATE ... WHERE ... IN (subselect) |
100 | - $idSubselect = 'SELECT ' . $idColumnNameList . ' FROM ' . $tempTable; |
|
100 | + $idSubselect = 'SELECT '.$idColumnNameList.' FROM '.$tempTable; |
|
101 | 101 | |
102 | 102 | // 3. Create and store UPDATE statements |
103 | 103 | $classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | foreach (array_reverse($classNames) as $className) { |
107 | 107 | $affected = false; |
108 | 108 | $class = $em->getClassMetadata($className); |
109 | - $updateSql = 'UPDATE ' . $quoteStrategy->getTableName($class, $platform) . ' SET '; |
|
109 | + $updateSql = 'UPDATE '.$quoteStrategy->getTableName($class, $platform).' SET '; |
|
110 | 110 | |
111 | 111 | foreach ($updateItems as $updateItem) { |
112 | 112 | $field = $updateItem->pathExpression->field; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | if ($affected) { |
136 | - $this->_sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnNameList . ') IN (' . $idSubselect . ')'; |
|
136 | + $this->_sqlStatements[$i] = $updateSql.' WHERE ('.$idColumnNameList.') IN ('.$idSubselect.')'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
160 | - $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' |
|
161 | - . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
160 | + $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' (' |
|
161 | + . $platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
162 | 162 | |
163 | 163 | $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable); |
164 | 164 | } |
@@ -19,7 +19,6 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\ORM\Query; |
21 | 21 | |
22 | -use Doctrine\DBAL\Types\Type; |
|
23 | 22 | use Doctrine\ORM\EntityManagerInterface; |
24 | 23 | use Doctrine\ORM\Mapping\ClassMetadataInfo; |
25 | 24 | use Doctrine\ORM\Mapping\MappingException; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if (isset($rootClass->associationMappings[$identifier])) { |
86 | 86 | throw new \RuntimeException( |
87 | - "Paginating an entity with foreign key as identifier only works when using the Output Walkers. " . |
|
87 | + "Paginating an entity with foreign key as identifier only works when using the Output Walkers. ". |
|
88 | 88 | "Call Paginator#setUseOutputWalkers(true) before iterating the paginator." |
89 | 89 | ); |
90 | 90 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | $AST->selectClause->selectExpressions[] = new SelectExpression( |
113 | 113 | $this->createSelectExpressionItem($item->expression), |
114 | - '_dctrn_ord' . $this->_aliasCounter++ |
|
114 | + '_dctrn_ord'.$this->_aliasCounter++ |
|
115 | 115 | ); |
116 | 116 | } |
117 | 117 | } |
@@ -19,7 +19,6 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\ORM\Query; |
21 | 21 | |
22 | -use Doctrine\DBAL\Types\Type; |
|
23 | 22 | use Doctrine\ORM\EntityManagerInterface; |
24 | 23 | use Doctrine\ORM\Mapping\ClassMetadataInfo; |
25 | 24 | use Doctrine\ORM\Mapping\MappingException; |
@@ -89,60 +89,60 @@ discard block |
||
89 | 89 | $cmf = $this->em->getMetadataFactory(); |
90 | 90 | |
91 | 91 | foreach ($class->associationMappings as $fieldName => $assoc) { |
92 | - if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { |
|
93 | - $ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.'; |
|
92 | + if ( ! class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { |
|
93 | + $ce[] = "The target entity '".$assoc['targetEntity']."' specified on ".$class->name.'#'.$fieldName.' is unknown or not an entity.'; |
|
94 | 94 | |
95 | 95 | return $ce; |
96 | 96 | } |
97 | 97 | |
98 | 98 | if ($assoc['mappedBy'] && $assoc['inversedBy']) { |
99 | - $ce[] = "The association " . $class . "#" . $fieldName . " cannot be defined as both inverse and owning."; |
|
99 | + $ce[] = "The association ".$class."#".$fieldName." cannot be defined as both inverse and owning."; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $targetMetadata = $cmf->getMetadataFor($assoc['targetEntity']); |
103 | 103 | |
104 | 104 | if (isset($assoc['id']) && $targetMetadata->containsForeignIdentifier) { |
105 | - $ce[] = "Cannot map association '" . $class->name. "#". $fieldName ." as identifier, because " . |
|
106 | - "the target entity '". $targetMetadata->name . "' also maps an association as identifier."; |
|
105 | + $ce[] = "Cannot map association '".$class->name."#".$fieldName." as identifier, because ". |
|
106 | + "the target entity '".$targetMetadata->name."' also maps an association as identifier."; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if ($assoc['mappedBy']) { |
110 | 110 | if ($targetMetadata->hasField($assoc['mappedBy'])) { |
111 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ". |
|
112 | - "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which is not defined as association, but as field."; |
|
111 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ". |
|
112 | + "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which is not defined as association, but as field."; |
|
113 | 113 | } |
114 | - if (!$targetMetadata->hasAssociation($assoc['mappedBy'])) { |
|
115 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ". |
|
116 | - "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which does not exist."; |
|
114 | + if ( ! $targetMetadata->hasAssociation($assoc['mappedBy'])) { |
|
115 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ". |
|
116 | + "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which does not exist."; |
|
117 | 117 | } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] == null) { |
118 | - $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the inverse side of a ". |
|
118 | + $ce[] = "The field ".$class->name."#".$fieldName." is on the inverse side of a ". |
|
119 | 119 | "bi-directional relationship, but the specified mappedBy association on the target-entity ". |
120 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ". |
|
121 | - "'inversedBy=\"" . $fieldName . "\"' attribute."; |
|
120 | + $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ". |
|
121 | + "'inversedBy=\"".$fieldName."\"' attribute."; |
|
122 | 122 | } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] != $fieldName) { |
123 | - $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " . |
|
124 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " are ". |
|
123 | + $ce[] = "The mappings ".$class->name."#".$fieldName." and ". |
|
124 | + $assoc['targetEntity']."#".$assoc['mappedBy']." are ". |
|
125 | 125 | "inconsistent with each other."; |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($assoc['inversedBy']) { |
130 | 130 | if ($targetMetadata->hasField($assoc['inversedBy'])) { |
131 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ". |
|
132 | - "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which is not defined as association."; |
|
131 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ". |
|
132 | + "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which is not defined as association."; |
|
133 | 133 | } |
134 | 134 | |
135 | - if (!$targetMetadata->hasAssociation($assoc['inversedBy'])) { |
|
136 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ". |
|
137 | - "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which does not exist."; |
|
135 | + if ( ! $targetMetadata->hasAssociation($assoc['inversedBy'])) { |
|
136 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ". |
|
137 | + "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which does not exist."; |
|
138 | 138 | } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] == null) { |
139 | - $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the owning side of a ". |
|
139 | + $ce[] = "The field ".$class->name."#".$fieldName." is on the owning side of a ". |
|
140 | 140 | "bi-directional relationship, but the specified mappedBy association on the target-entity ". |
141 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ". |
|
141 | + $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ". |
|
142 | 142 | "'inversedBy' attribute."; |
143 | 143 | } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] != $fieldName) { |
144 | - $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " . |
|
145 | - $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " are ". |
|
144 | + $ce[] = "The mappings ".$class->name."#".$fieldName." and ". |
|
145 | + $assoc['targetEntity']."#".$assoc['inversedBy']." are ". |
|
146 | 146 | "inconsistent with each other."; |
147 | 147 | } |
148 | 148 | |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) { |
151 | 151 | $targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']]; |
152 | 152 | if ($assoc['type'] == ClassMetadata::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadata::ONE_TO_ONE) { |
153 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is one-to-one, then the inversed " . |
|
154 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-one as well."; |
|
153 | + $ce[] = "If association ".$class->name."#".$fieldName." is one-to-one, then the inversed ". |
|
154 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-one as well."; |
|
155 | 155 | } elseif ($assoc['type'] == ClassMetadata::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadata::ONE_TO_MANY) { |
156 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-one, then the inversed " . |
|
157 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-many."; |
|
156 | + $ce[] = "If association ".$class->name."#".$fieldName." is many-to-one, then the inversed ". |
|
157 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-many."; |
|
158 | 158 | } elseif ($assoc['type'] == ClassMetadata::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadata::MANY_TO_MANY) { |
159 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-many, then the inversed " . |
|
160 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be many-to-many as well."; |
|
159 | + $ce[] = "If association ".$class->name."#".$fieldName." is many-to-many, then the inversed ". |
|
160 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be many-to-many as well."; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
@@ -168,32 +168,32 @@ discard block |
||
168 | 168 | $targetIdentifierColumns = array_keys($targetMetadata->getIdentifierColumns($this->em)); |
169 | 169 | |
170 | 170 | foreach ($assoc['joinTable']['joinColumns'] as $joinColumn) { |
171 | - if (!in_array($joinColumn['referencedColumnName'], $classIdentifierColumns)) { |
|
172 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
171 | + if ( ! in_array($joinColumn['referencedColumnName'], $classIdentifierColumns)) { |
|
172 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
173 | 173 | "has to be a primary key column on the target entity class '".$class->name."'."; |
174 | 174 | break; |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | 178 | foreach ($assoc['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) { |
179 | - if (!in_array($inverseJoinColumn['referencedColumnName'], $targetIdentifierColumns)) { |
|
180 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
179 | + if ( ! in_array($inverseJoinColumn['referencedColumnName'], $targetIdentifierColumns)) { |
|
180 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
181 | 181 | "has to be a primary key column on the target entity class '".$targetMetadata->name."'."; |
182 | 182 | break; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | 186 | if (count($targetIdentifierColumns) !== count($assoc['joinTable']['inverseJoinColumns'])) { |
187 | - $ce[] = "The inverse join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " . |
|
188 | - "have to contain to ALL identifier columns of the target entity '". $targetMetadata->name . "', " . |
|
189 | - "however '" . implode(", ", array_diff($targetIdentifierColumns, array_values($assoc['relationToTargetKeyColumns']))) . |
|
187 | + $ce[] = "The inverse join columns of the many-to-many table '".$assoc['joinTable']['name']."' ". |
|
188 | + "have to contain to ALL identifier columns of the target entity '".$targetMetadata->name."', ". |
|
189 | + "however '".implode(", ", array_diff($targetIdentifierColumns, array_values($assoc['relationToTargetKeyColumns']))). |
|
190 | 190 | "' are missing."; |
191 | 191 | } |
192 | 192 | |
193 | 193 | if (count($classIdentifierColumns) !== count($assoc['joinTable']['joinColumns'])) { |
194 | - $ce[] = "The join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " . |
|
195 | - "have to contain to ALL identifier columns of the source entity '". $class->name . "', " . |
|
196 | - "however '" . implode(", ", array_diff($classIdentifierColumns, array_values($assoc['relationToSourceKeyColumns']))) . |
|
194 | + $ce[] = "The join columns of the many-to-many table '".$assoc['joinTable']['name']."' ". |
|
195 | + "have to contain to ALL identifier columns of the source entity '".$class->name."', ". |
|
196 | + "however '".implode(", ", array_diff($classIdentifierColumns, array_values($assoc['relationToSourceKeyColumns']))). |
|
197 | 197 | "' are missing."; |
198 | 198 | } |
199 | 199 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | $identifierColumns = array_keys($targetMetadata->getIdentifierColumns($this->em)); |
202 | 202 | |
203 | 203 | foreach ($assoc['joinColumns'] as $joinColumn) { |
204 | - if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
205 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
204 | + if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
205 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
206 | 206 | "has to be a primary key column on the target entity class '".$targetMetadata->name."'."; |
207 | 207 | } |
208 | 208 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | $ids[] = $joinColumn['name']; |
215 | 215 | } |
216 | 216 | |
217 | - $ce[] = "The join columns of the association '" . $assoc['fieldName'] . "' " . |
|
218 | - "have to match to ALL identifier columns of the target entity '". $targetMetadata->name . "', " . |
|
219 | - "however '" . implode(", ", array_diff($identifierColumns, $ids)) . |
|
217 | + $ce[] = "The join columns of the association '".$assoc['fieldName']."' ". |
|
218 | + "have to match to ALL identifier columns of the target entity '".$targetMetadata->name."', ". |
|
219 | + "however '".implode(", ", array_diff($identifierColumns, $ids)). |
|
220 | 220 | "' are missing."; |
221 | 221 | } |
222 | 222 | } |
@@ -224,19 +224,19 @@ discard block |
||
224 | 224 | |
225 | 225 | if (isset($assoc['orderBy']) && $assoc['orderBy'] !== null) { |
226 | 226 | foreach ($assoc['orderBy'] as $orderField => $orientation) { |
227 | - if (!$targetMetadata->hasField($orderField) && !$targetMetadata->hasAssociation($orderField)) { |
|
228 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a foreign field " . |
|
229 | - $orderField . " that is not a field on the target entity " . $targetMetadata->name . "."; |
|
227 | + if ( ! $targetMetadata->hasField($orderField) && ! $targetMetadata->hasAssociation($orderField)) { |
|
228 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a foreign field ". |
|
229 | + $orderField." that is not a field on the target entity ".$targetMetadata->name."."; |
|
230 | 230 | continue; |
231 | 231 | } |
232 | 232 | if ($targetMetadata->isCollectionValuedAssociation($orderField)) { |
233 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " . |
|
234 | - $orderField . " on " . $targetMetadata->name . " that is a collection-valued association."; |
|
233 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ". |
|
234 | + $orderField." on ".$targetMetadata->name." that is a collection-valued association."; |
|
235 | 235 | continue; |
236 | 236 | } |
237 | 237 | if ($targetMetadata->isAssociationInverseSide($orderField)) { |
238 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " . |
|
239 | - $orderField . " on " . $targetMetadata->name . " that is the inverse side of an association."; |
|
238 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ". |
|
239 | + $orderField." on ".$targetMetadata->name." that is the inverse side of an association."; |
|
240 | 240 | continue; |
241 | 241 | } |
242 | 242 | } |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | foreach ($class->subClasses as $subClass) { |
247 | - if (!in_array($class->name, class_parents($subClass))) { |
|
248 | - $ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ". |
|
249 | - "of '" . $class->name . "' but these entities are not related through inheritance."; |
|
247 | + if ( ! in_array($class->name, class_parents($subClass))) { |
|
248 | + $ce[] = "According to the discriminator map class '".$subClass."' has to be a child ". |
|
249 | + "of '".$class->name."' but these entities are not related through inheritance."; |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 |
@@ -4,9 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Doctrine\ORM\EntityManagerInterface; |
6 | 6 | use Doctrine\ORM\Proxy\ProxyFactory; |
7 | -use Doctrine\ORM\Query; |
|
8 | 7 | use Doctrine\ORM\Query\ResultSetMapping; |
9 | -use Doctrine\Tests\ORM\Performance\MockUnitOfWork; |
|
10 | 8 | |
11 | 9 | /** |
12 | 10 | * An entity manager mock that prevents lazy-loading of proxies |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Doctrine\Tests\ORM\Functional; |
4 | 4 | |
5 | -use Doctrine\ORM\Query; |
|
6 | 5 | use Doctrine\Tests\Models\CMS\CmsUser; |
7 | 6 | use Doctrine\Tests\OrmFunctionalTestCase; |
8 | 7 |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | namespace Doctrine\Tests\ORM\Functional; |
4 | -use Doctrine\Common\Util\Debug; |
|
5 | 4 | use Doctrine\ORM\ORMException; |
6 | 5 | use Doctrine\ORM\Query\QueryException; |
7 | 6 | use Doctrine\Tests\Models\Navigation\NavCountry; |
@@ -19,7 +19,6 @@ |
||
19 | 19 | |
20 | 20 | namespace Doctrine\ORM\Query; |
21 | 21 | |
22 | -use Doctrine\DBAL\Types\Type; |
|
23 | 22 | use Doctrine\ORM\EntityManagerInterface; |
24 | 23 | use Doctrine\ORM\Mapping\ClassMetadataInfo; |
25 | 24 | use Doctrine\ORM\Mapping\MappingException; |
@@ -51,6 +51,10 @@ |
||
51 | 51 | $this->_em = $this->_getTestEntityManager(); |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $dqlToBeTested |
|
56 | + * @param string $sqlToBeConfirmed |
|
57 | + */ |
|
54 | 58 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
55 | 59 | { |
56 | 60 | try { |