Complex classes like SqlWalker often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SqlWalker, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
42 | class SqlWalker implements TreeWalker |
||
43 | { |
||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | const HINT_DISTINCT = 'doctrine.distinct'; |
||
48 | |||
49 | /** |
||
50 | * @var ResultSetMapping |
||
51 | */ |
||
52 | private $rsm; |
||
53 | |||
54 | /** |
||
55 | * Counter for generating unique column aliases. |
||
56 | * |
||
57 | * @var integer |
||
58 | */ |
||
59 | private $aliasCounter = 0; |
||
60 | |||
61 | /** |
||
62 | * Counter for generating unique table aliases. |
||
63 | * |
||
64 | * @var integer |
||
65 | */ |
||
66 | private $tableAliasCounter = 0; |
||
67 | |||
68 | /** |
||
69 | * Counter for generating unique scalar result. |
||
70 | * |
||
71 | * @var integer |
||
72 | */ |
||
73 | private $scalarResultCounter = 1; |
||
74 | |||
75 | /** |
||
76 | * Counter for generating unique parameter indexes. |
||
77 | * |
||
78 | * @var integer |
||
79 | */ |
||
80 | private $sqlParamIndex = 0; |
||
81 | |||
82 | /** |
||
83 | * Counter for generating indexes. |
||
84 | * |
||
85 | * @var integer |
||
86 | */ |
||
87 | private $newObjectCounter = 0; |
||
88 | |||
89 | /** |
||
90 | * @var ParserResult |
||
91 | */ |
||
92 | private $parserResult; |
||
93 | |||
94 | /** |
||
95 | * @var \Doctrine\ORM\EntityManager |
||
96 | */ |
||
97 | private $em; |
||
98 | |||
99 | /** |
||
100 | * @var \Doctrine\DBAL\Connection |
||
101 | */ |
||
102 | private $conn; |
||
103 | |||
104 | /** |
||
105 | * @var \Doctrine\ORM\AbstractQuery |
||
106 | */ |
||
107 | private $query; |
||
108 | |||
109 | /** |
||
110 | * @var array |
||
111 | */ |
||
112 | private $tableAliasMap = []; |
||
113 | |||
114 | /** |
||
115 | * Map from result variable names to their SQL column alias names. |
||
116 | * |
||
117 | * @var array |
||
118 | */ |
||
119 | private $scalarResultAliasMap = []; |
||
120 | |||
121 | /** |
||
122 | * Map from Table-Alias + Column-Name to OrderBy-Direction. |
||
123 | * |
||
124 | * @var array |
||
125 | */ |
||
126 | private $orderedColumnsMap = []; |
||
127 | |||
128 | /** |
||
129 | * Map from DQL-Alias + Field-Name to SQL Column Alias. |
||
130 | * |
||
131 | * @var array |
||
132 | */ |
||
133 | private $scalarFields = []; |
||
134 | |||
135 | /** |
||
136 | * Map of all components/classes that appear in the DQL query. |
||
137 | * |
||
138 | * @var array |
||
139 | */ |
||
140 | private $queryComponents; |
||
141 | |||
142 | /** |
||
143 | * A list of classes that appear in non-scalar SelectExpressions. |
||
144 | * |
||
145 | * @var array |
||
146 | */ |
||
147 | private $selectedClasses = []; |
||
148 | |||
149 | /** |
||
150 | * The DQL alias of the root class of the currently traversed query. |
||
151 | * |
||
152 | * @var array |
||
153 | */ |
||
154 | private $rootAliases = []; |
||
155 | |||
156 | /** |
||
157 | * Flag that indicates whether to generate SQL table aliases in the SQL. |
||
158 | * These should only be generated for SELECT queries, not for UPDATE/DELETE. |
||
159 | * |
||
160 | * @var boolean |
||
161 | */ |
||
162 | private $useSqlTableAliases = true; |
||
163 | |||
164 | /** |
||
165 | * The database platform abstraction. |
||
166 | * |
||
167 | * @var \Doctrine\DBAL\Platforms\AbstractPlatform |
||
168 | */ |
||
169 | private $platform; |
||
170 | |||
171 | /** |
||
172 | * The quote strategy. |
||
173 | * |
||
174 | * @var \Doctrine\ORM\Mapping\QuoteStrategy |
||
175 | */ |
||
176 | private $quoteStrategy; |
||
177 | |||
178 | /** |
||
179 | * {@inheritDoc} |
||
180 | */ |
||
181 | 626 | public function __construct($query, $parserResult, array $queryComponents) |
|
192 | |||
193 | /** |
||
194 | * Gets the Query instance used by the walker. |
||
195 | * |
||
196 | * @return Query. |
||
|
|||
197 | */ |
||
198 | public function getQuery() |
||
202 | |||
203 | /** |
||
204 | * Gets the Connection used by the walker. |
||
205 | * |
||
206 | * @return \Doctrine\DBAL\Connection |
||
207 | */ |
||
208 | 34 | public function getConnection() |
|
212 | |||
213 | /** |
||
214 | * Gets the EntityManager used by the walker. |
||
215 | * |
||
216 | * @return \Doctrine\ORM\EntityManager |
||
217 | */ |
||
218 | 20 | public function getEntityManager() |
|
222 | |||
223 | /** |
||
224 | * Gets the information about a single query component. |
||
225 | * |
||
226 | * @param string $dqlAlias The DQL alias. |
||
227 | * |
||
228 | * @return array |
||
229 | */ |
||
230 | 17 | public function getQueryComponent($dqlAlias) |
|
234 | |||
235 | /** |
||
236 | * {@inheritdoc} |
||
237 | */ |
||
238 | public function getQueryComponents() |
||
242 | |||
243 | /** |
||
244 | * {@inheritdoc} |
||
245 | */ |
||
246 | 1 | public function setQueryComponent($dqlAlias, array $queryComponent) |
|
256 | |||
257 | /** |
||
258 | * {@inheritdoc} |
||
259 | */ |
||
260 | 620 | public function getExecutor($AST) |
|
281 | |||
282 | /** |
||
283 | * Generates a unique, short SQL table alias. |
||
284 | * |
||
285 | * @param string $tableName Table name |
||
286 | * @param string $dqlAlias The DQL alias. |
||
287 | * |
||
288 | * @return string Generated table alias. |
||
289 | */ |
||
290 | 572 | public function getSQLTableAlias($tableName, $dqlAlias = '') |
|
301 | |||
302 | /** |
||
303 | * Forces the SqlWalker to use a specific alias for a table name, rather than |
||
304 | * generating an alias on its own. |
||
305 | * |
||
306 | * @param string $tableName |
||
307 | * @param string $alias |
||
308 | * @param string $dqlAlias |
||
309 | * |
||
310 | * @return string |
||
311 | */ |
||
312 | 63 | public function setSQLTableAlias($tableName, $alias, $dqlAlias = '') |
|
320 | |||
321 | /** |
||
322 | * Gets an SQL column alias for a column name. |
||
323 | * |
||
324 | * @param string $columnName |
||
325 | * |
||
326 | * @return string |
||
327 | */ |
||
328 | 561 | public function getSQLColumnAlias($columnName) |
|
332 | |||
333 | /** |
||
334 | * Generates the SQL JOINs that are necessary for Class Table Inheritance |
||
335 | * for the given class. |
||
336 | * |
||
337 | * @param ClassMetadata $class The class for which to generate the joins. |
||
338 | * @param string $dqlAlias The DQL alias of the class. |
||
339 | * |
||
340 | * @return string The SQL. |
||
341 | */ |
||
342 | 81 | private function _generateClassTableInheritanceJoins($class, $dqlAlias) |
|
394 | |||
395 | /** |
||
396 | * @return string |
||
397 | */ |
||
398 | 555 | private function _generateOrderedCollectionOrderByItems() |
|
432 | |||
433 | /** |
||
434 | * Generates a discriminator column SQL condition for the class with the given DQL alias. |
||
435 | * |
||
436 | * @param array $dqlAliases List of root DQL aliases to inspect for discriminator restrictions. |
||
437 | * |
||
438 | * @return string |
||
439 | */ |
||
440 | 615 | private function _generateDiscriminatorColumnConditionSQL(array $dqlAliases) |
|
471 | |||
472 | /** |
||
473 | * Generates the filter SQL for a given entity and table alias. |
||
474 | * |
||
475 | * @param ClassMetadata $targetEntity Metadata of the target entity. |
||
476 | * @param string $targetTableAlias The table alias of the joined/selected table. |
||
477 | * |
||
478 | * @return string The SQL query part to add to a query. |
||
479 | */ |
||
480 | 286 | private function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias) |
|
481 | { |
||
482 | 286 | if (!$this->em->hasFilters()) { |
|
483 | 250 | return ''; |
|
484 | } |
||
485 | |||
486 | 41 | switch($targetEntity->inheritanceType) { |
|
487 | 41 | case ClassMetadata::INHERITANCE_TYPE_NONE: |
|
488 | 31 | break; |
|
489 | 10 | case ClassMetadata::INHERITANCE_TYPE_JOINED: |
|
490 | // The classes in the inheritance will be added to the query one by one, |
||
491 | // but only the root node is getting filtered |
||
492 | 6 | if ($targetEntity->name !== $targetEntity->rootEntityName) { |
|
493 | 4 | return ''; |
|
494 | } |
||
495 | 6 | break; |
|
496 | 4 | case ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE: |
|
497 | // With STI the table will only be queried once, make sure that the filters |
||
498 | // are added to the root entity |
||
499 | 4 | $targetEntity = $this->em->getClassMetadata($targetEntity->rootEntityName); |
|
500 | 4 | break; |
|
501 | default: |
||
502 | //@todo: throw exception? |
||
503 | return ''; |
||
504 | } |
||
505 | |||
506 | 41 | $filterClauses = []; |
|
507 | 41 | foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
|
508 | 10 | if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
|
509 | 10 | $filterClauses[] = '(' . $filterExpr . ')'; |
|
510 | } |
||
511 | } |
||
512 | |||
513 | 41 | return implode(' AND ', $filterClauses); |
|
514 | } |
||
515 | |||
516 | /** |
||
517 | * {@inheritdoc} |
||
518 | */ |
||
519 | 561 | public function walkSelectStatement(AST\SelectStatement $AST) |
|
572 | |||
573 | /** |
||
574 | * {@inheritdoc} |
||
575 | */ |
||
576 | 25 | public function walkUpdateStatement(AST\UpdateStatement $AST) |
|
584 | |||
585 | /** |
||
586 | * {@inheritdoc} |
||
587 | */ |
||
588 | 36 | public function walkDeleteStatement(AST\DeleteStatement $AST) |
|
596 | |||
597 | /** |
||
598 | * Walks down an IdentificationVariable AST node, thereby generating the appropriate SQL. |
||
599 | * This one differs of ->walkIdentificationVariable() because it generates the entity identifiers. |
||
600 | * |
||
601 | * @param string $identVariable |
||
602 | * |
||
603 | * @return string |
||
604 | */ |
||
605 | 2 | public function walkEntityIdentificationVariable($identVariable) |
|
617 | |||
618 | /** |
||
619 | * Walks down an IdentificationVariable (no AST node associated), thereby generating the SQL. |
||
620 | * |
||
621 | * @param string $identificationVariable |
||
622 | * @param string $fieldName |
||
623 | * |
||
624 | * @return string The SQL. |
||
625 | */ |
||
626 | 360 | public function walkIdentificationVariable($identificationVariable, $fieldName = null) |
|
639 | |||
640 | /** |
||
641 | * {@inheritdoc} |
||
642 | */ |
||
643 | 429 | public function walkPathExpression($pathExpr) |
|
695 | |||
696 | /** |
||
697 | * {@inheritdoc} |
||
698 | */ |
||
699 | 561 | public function walkSelectClause($selectClause) |
|
700 | { |
||
701 | 561 | $sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
|
702 | 561 | $sqlSelectExpressions = array_filter(array_map([$this, 'walkSelectExpression'], $selectClause->selectExpressions)); |
|
703 | |||
704 | 561 | if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) { |
|
705 | 1 | $this->query->setHint(self::HINT_DISTINCT, true); |
|
706 | } |
||
707 | |||
708 | 561 | $addMetaColumns = ! $this->query->getHint(Query::HINT_FORCE_PARTIAL_LOAD) && |
|
709 | 417 | $this->query->getHydrationMode() == Query::HYDRATE_OBJECT |
|
710 | || |
||
711 | 257 | $this->query->getHydrationMode() != Query::HYDRATE_OBJECT && |
|
712 | 561 | $this->query->getHint(Query::HINT_INCLUDE_META_COLUMNS); |
|
713 | |||
714 | 561 | foreach ($this->selectedClasses as $selectedClass) { |
|
715 | 460 | $class = $selectedClass['class']; |
|
716 | 460 | $dqlAlias = $selectedClass['dqlAlias']; |
|
717 | 460 | $resultAlias = $selectedClass['resultAlias']; |
|
718 | |||
719 | // Register as entity or joined entity result |
||
720 | 460 | if ($this->queryComponents[$dqlAlias]['relation'] === null) { |
|
721 | 460 | $this->rsm->addEntityResult($class->name, $dqlAlias, $resultAlias); |
|
722 | } else { |
||
723 | 151 | $this->rsm->addJoinedEntityResult( |
|
724 | 151 | $class->name, |
|
725 | $dqlAlias, |
||
726 | 151 | $this->queryComponents[$dqlAlias]['parent'], |
|
727 | 151 | $this->queryComponents[$dqlAlias]['relation']['fieldName'] |
|
728 | ); |
||
729 | } |
||
730 | |||
731 | 460 | if ($class->isInheritanceTypeSingleTable() || $class->isInheritanceTypeJoined()) { |
|
732 | // Add discriminator columns to SQL |
||
733 | 90 | $rootClass = $this->em->getClassMetadata($class->rootEntityName); |
|
734 | 90 | $tblAlias = $this->getSQLTableAlias($rootClass->getTableName(), $dqlAlias); |
|
735 | 90 | $discrColumn = $rootClass->discriminatorColumn; |
|
736 | 90 | $columnAlias = $this->getSQLColumnAlias($discrColumn['name']); |
|
737 | |||
738 | 90 | $sqlSelectExpressions[] = $tblAlias . '.' . $discrColumn['name'] . ' AS ' . $columnAlias; |
|
739 | |||
740 | 90 | $this->rsm->setDiscriminatorColumn($dqlAlias, $columnAlias); |
|
741 | 90 | $this->rsm->addMetaResult($dqlAlias, $columnAlias, $discrColumn['fieldName'], false, $discrColumn['type']); |
|
742 | } |
||
743 | |||
744 | // Add foreign key columns to SQL, if necessary |
||
745 | 460 | if ( ! $addMetaColumns && ! $class->containsForeignIdentifier) { |
|
746 | 173 | continue; |
|
747 | } |
||
748 | |||
749 | // Add foreign key columns of class and also parent classes |
||
750 | 332 | foreach ($class->associationMappings as $assoc) { |
|
751 | 299 | if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)) { |
|
752 | 250 | continue; |
|
753 | 276 | } else if ( !$addMetaColumns && !isset($assoc['id'])) { |
|
754 | continue; |
||
755 | } |
||
756 | |||
757 | 276 | $targetClass = $this->em->getClassMetadata($assoc['targetEntity']); |
|
758 | 276 | $isIdentifier = (isset($assoc['id']) && $assoc['id'] === true); |
|
759 | 276 | $owningClass = (isset($assoc['inherited'])) ? $this->em->getClassMetadata($assoc['inherited']) : $class; |
|
760 | 276 | $sqlTableAlias = $this->getSQLTableAlias($owningClass->getTableName(), $dqlAlias); |
|
761 | |||
762 | 276 | foreach ($assoc['joinColumns'] as $joinColumn) { |
|
763 | 276 | $columnName = $joinColumn['name']; |
|
764 | 276 | $columnAlias = $this->getSQLColumnAlias($columnName); |
|
765 | 276 | $columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
|
766 | |||
767 | 276 | $quotedColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
|
768 | 276 | $sqlSelectExpressions[] = $sqlTableAlias . '.' . $quotedColumnName . ' AS ' . $columnAlias; |
|
769 | |||
770 | 276 | $this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $isIdentifier, $columnType); |
|
771 | } |
||
772 | } |
||
773 | |||
774 | // Add foreign key columns to SQL, if necessary |
||
775 | 332 | if ( ! $addMetaColumns) { |
|
776 | 8 | continue; |
|
777 | } |
||
778 | |||
779 | // Add foreign key columns of subclasses |
||
780 | 327 | foreach ($class->subClasses as $subClassName) { |
|
781 | 31 | $subClass = $this->em->getClassMetadata($subClassName); |
|
782 | 31 | $sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
|
783 | |||
784 | 31 | foreach ($subClass->associationMappings as $assoc) { |
|
785 | // Skip if association is inherited |
||
786 | 27 | if (isset($assoc['inherited'])) continue; |
|
787 | |||
788 | 16 | if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) { |
|
789 | 14 | $targetClass = $this->em->getClassMetadata($assoc['targetEntity']); |
|
790 | |||
791 | 14 | foreach ($assoc['joinColumns'] as $joinColumn) { |
|
792 | 14 | $columnName = $joinColumn['name']; |
|
793 | 14 | $columnAlias = $this->getSQLColumnAlias($columnName); |
|
794 | 14 | $columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
|
795 | |||
796 | 14 | $quotedColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $subClass, $this->platform); |
|
797 | 14 | $sqlSelectExpressions[] = $sqlTableAlias . '.' . $quotedColumnName . ' AS ' . $columnAlias; |
|
798 | |||
799 | 327 | $this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $subClass->isIdentifier($columnName), $columnType); |
|
800 | } |
||
801 | } |
||
802 | } |
||
803 | } |
||
804 | } |
||
805 | |||
806 | 561 | $sql .= implode(', ', $sqlSelectExpressions); |
|
807 | |||
808 | 561 | return $sql; |
|
809 | } |
||
810 | |||
811 | /** |
||
812 | * {@inheritdoc} |
||
813 | */ |
||
814 | 563 | public function walkFromClause($fromClause) |
|
825 | |||
826 | /** |
||
827 | * Walks down a IdentificationVariableDeclaration AST node, thereby generating the appropriate SQL. |
||
828 | * |
||
829 | * @param AST\IdentificationVariableDeclaration $identificationVariableDecl |
||
830 | * |
||
831 | * @return string |
||
832 | */ |
||
833 | 564 | public function walkIdentificationVariableDeclaration($identificationVariableDecl) |
|
847 | |||
848 | /** |
||
849 | * Walks down a IndexBy AST node. |
||
850 | * |
||
851 | * @param AST\IndexBy $indexBy |
||
852 | * |
||
853 | * @return void |
||
854 | */ |
||
855 | 8 | public function walkIndexBy($indexBy) |
|
869 | |||
870 | /** |
||
871 | * Walks down a RangeVariableDeclaration AST node, thereby generating the appropriate SQL. |
||
872 | * |
||
873 | * @param AST\RangeVariableDeclaration $rangeVariableDeclaration |
||
874 | * |
||
875 | * @return string |
||
876 | */ |
||
877 | 564 | public function walkRangeVariableDeclaration($rangeVariableDeclaration) |
|
898 | |||
899 | /** |
||
900 | * Walks down a JoinAssociationDeclaration AST node, thereby generating the appropriate SQL. |
||
901 | * |
||
902 | * @param AST\JoinAssociationDeclaration $joinAssociationDeclaration |
||
903 | * @param int $joinType |
||
904 | * @param AST\ConditionalExpression $condExpr |
||
905 | * |
||
906 | * @return string |
||
907 | * |
||
908 | * @throws QueryException |
||
909 | */ |
||
910 | 208 | public function walkJoinAssociationDeclaration($joinAssociationDeclaration, $joinType = AST\Join::JOIN_TYPE_INNER, $condExpr = null) |
|
911 | { |
||
912 | 208 | $sql = ''; |
|
913 | |||
914 | 208 | $associationPathExpression = $joinAssociationDeclaration->joinAssociationPathExpression; |
|
915 | 208 | $joinedDqlAlias = $joinAssociationDeclaration->aliasIdentificationVariable; |
|
916 | 208 | $indexBy = $joinAssociationDeclaration->indexBy; |
|
917 | |||
918 | 208 | $relation = $this->queryComponents[$joinedDqlAlias]['relation']; |
|
919 | 208 | $targetClass = $this->em->getClassMetadata($relation['targetEntity']); |
|
920 | 208 | $sourceClass = $this->em->getClassMetadata($relation['sourceEntity']); |
|
921 | 208 | $targetTableName = $this->quoteStrategy->getTableName($targetClass, $this->platform); |
|
922 | |||
923 | 208 | $targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName(), $joinedDqlAlias); |
|
924 | 208 | $sourceTableAlias = $this->getSQLTableAlias($sourceClass->getTableName(), $associationPathExpression->identificationVariable); |
|
925 | |||
926 | // Ensure we got the owning side, since it has all mapping info |
||
927 | 208 | $assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation; |
|
928 | |||
929 | 208 | if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
|
930 | 3 | if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) { |
|
931 | 2 | throw QueryException::iterateWithFetchJoinNotAllowed($assoc); |
|
932 | } |
||
933 | } |
||
934 | |||
935 | 206 | $targetTableJoin = null; |
|
936 | |||
937 | // This condition is not checking ClassMetadata::MANY_TO_ONE, because by definition it cannot |
||
938 | // be the owning side and previously we ensured that $assoc is always the owning side of the associations. |
||
939 | // The owning side is necessary at this point because only it contains the JoinColumn information. |
||
940 | switch (true) { |
||
941 | 206 | case ($assoc['type'] & ClassMetadata::TO_ONE): |
|
942 | 171 | $conditions = []; |
|
943 | |||
944 | 171 | foreach ($assoc['joinColumns'] as $joinColumn) { |
|
945 | 171 | $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
946 | 171 | $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
947 | |||
948 | 171 | if ($relation['isOwningSide']) { |
|
949 | 99 | $conditions[] = $sourceTableAlias . '.' . $quotedSourceColumn . ' = ' . $targetTableAlias . '.' . $quotedTargetColumn; |
|
950 | |||
951 | 99 | continue; |
|
952 | } |
||
953 | |||
954 | 103 | $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $targetTableAlias . '.' . $quotedSourceColumn; |
|
955 | } |
||
956 | |||
957 | // Apply remaining inheritance restrictions |
||
958 | 171 | $discrSql = $this->_generateDiscriminatorColumnConditionSQL([$joinedDqlAlias]); |
|
959 | |||
960 | 171 | if ($discrSql) { |
|
961 | 3 | $conditions[] = $discrSql; |
|
962 | } |
||
963 | |||
964 | // Apply the filters |
||
965 | 171 | $filterExpr = $this->generateFilterConditionSQL($targetClass, $targetTableAlias); |
|
966 | |||
967 | 171 | if ($filterExpr) { |
|
968 | 1 | $conditions[] = $filterExpr; |
|
969 | } |
||
970 | |||
971 | $targetTableJoin = [ |
||
972 | 171 | 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
973 | 171 | 'condition' => implode(' AND ', $conditions), |
|
974 | ]; |
||
975 | 171 | break; |
|
976 | |||
977 | 45 | case ($assoc['type'] == ClassMetadata::MANY_TO_MANY): |
|
978 | // Join relation table |
||
979 | 45 | $joinTable = $assoc['joinTable']; |
|
980 | 45 | $joinTableAlias = $this->getSQLTableAlias($joinTable['name'], $joinedDqlAlias); |
|
981 | 45 | $joinTableName = $this->quoteStrategy->getJoinTableName($assoc, $sourceClass, $this->platform); |
|
982 | |||
983 | 45 | $conditions = []; |
|
984 | 45 | $relationColumns = ($relation['isOwningSide']) |
|
985 | 42 | ? $assoc['joinTable']['joinColumns'] |
|
986 | 45 | : $assoc['joinTable']['inverseJoinColumns']; |
|
987 | |||
988 | 45 | foreach ($relationColumns as $joinColumn) { |
|
989 | 45 | $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
990 | 45 | $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
991 | |||
992 | 45 | $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
993 | } |
||
994 | |||
995 | 45 | $sql .= $joinTableName . ' ' . $joinTableAlias . ' ON ' . implode(' AND ', $conditions); |
|
996 | |||
997 | // Join target table |
||
998 | 45 | $sql .= ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) ? ' LEFT JOIN ' : ' INNER JOIN '; |
|
999 | |||
1000 | 45 | $conditions = []; |
|
1001 | 45 | $relationColumns = ($relation['isOwningSide']) |
|
1002 | 42 | ? $assoc['joinTable']['inverseJoinColumns'] |
|
1003 | 45 | : $assoc['joinTable']['joinColumns']; |
|
1004 | |||
1005 | 45 | foreach ($relationColumns as $joinColumn) { |
|
1006 | 45 | $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
1007 | 45 | $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
1008 | |||
1009 | 45 | $conditions[] = $targetTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1010 | } |
||
1011 | |||
1012 | // Apply remaining inheritance restrictions |
||
1013 | 45 | $discrSql = $this->_generateDiscriminatorColumnConditionSQL([$joinedDqlAlias]); |
|
1014 | |||
1015 | 45 | if ($discrSql) { |
|
1016 | $conditions[] = $discrSql; |
||
1017 | } |
||
1018 | |||
1019 | // Apply the filters |
||
1020 | 45 | $filterExpr = $this->generateFilterConditionSQL($targetClass, $targetTableAlias); |
|
1021 | |||
1022 | 45 | if ($filterExpr) { |
|
1023 | 1 | $conditions[] = $filterExpr; |
|
1024 | } |
||
1025 | |||
1026 | $targetTableJoin = [ |
||
1027 | 45 | 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
1028 | 45 | 'condition' => implode(' AND ', $conditions), |
|
1029 | ]; |
||
1030 | 45 | break; |
|
1031 | |||
1032 | default: |
||
1033 | throw new \BadMethodCallException('Type of association must be one of *_TO_ONE or MANY_TO_MANY'); |
||
1034 | } |
||
1035 | |||
1036 | // Handle WITH clause |
||
1037 | 206 | $withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')'); |
|
1038 | |||
1039 | 206 | if ($targetClass->isInheritanceTypeJoined()) { |
|
1040 | 9 | $ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); |
|
1041 | // If we have WITH condition, we need to build nested joins for target class table and cti joins |
||
1042 | 9 | if ($withCondition) { |
|
1043 | 1 | $sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition']; |
|
1044 | } else { |
||
1045 | 9 | $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins; |
|
1046 | } |
||
1047 | } else { |
||
1048 | 197 | $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition']; |
|
1049 | } |
||
1050 | |||
1051 | 206 | if ($withCondition) { |
|
1052 | 5 | $sql .= ' AND ' . $withCondition; |
|
1053 | } |
||
1054 | |||
1055 | // Apply the indexes |
||
1056 | 206 | if ($indexBy) { |
|
1057 | // For Many-To-One or One-To-One associations this obviously makes no sense, but is ignored silently. |
||
1058 | 5 | $this->walkIndexBy($indexBy); |
|
1059 | 201 | } else if (isset($relation['indexBy'])) { |
|
1060 | 3 | $this->rsm->addIndexBy($joinedDqlAlias, $relation['indexBy']); |
|
1061 | } |
||
1062 | |||
1063 | 206 | return $sql; |
|
1064 | } |
||
1065 | |||
1066 | /** |
||
1067 | * {@inheritdoc} |
||
1068 | */ |
||
1069 | 54 | public function walkFunction($function) |
|
1073 | |||
1074 | /** |
||
1075 | * {@inheritdoc} |
||
1076 | */ |
||
1077 | 132 | public function walkOrderByClause($orderByClause) |
|
1087 | |||
1088 | /** |
||
1089 | * {@inheritdoc} |
||
1090 | */ |
||
1091 | 148 | public function walkOrderByItem($orderByItem) |
|
1092 | { |
||
1093 | 148 | $type = strtoupper($orderByItem->type); |
|
1094 | 148 | $expr = $orderByItem->expression; |
|
1095 | 148 | $sql = ($expr instanceof AST\Node) |
|
1096 | 145 | ? $expr->dispatch($this) |
|
1097 | 147 | : $this->walkResultVariable($this->queryComponents[$expr]['token']['value']); |
|
1098 | |||
1099 | 147 | $this->orderedColumnsMap[$sql] = $type; |
|
1100 | |||
1101 | 147 | if ($expr instanceof AST\Subselect) { |
|
1102 | return '(' . $sql . ') ' . $type; |
||
1103 | } |
||
1104 | |||
1105 | 147 | return $sql . ' ' . $type; |
|
1106 | } |
||
1107 | |||
1108 | /** |
||
1109 | * {@inheritdoc} |
||
1110 | */ |
||
1111 | 3 | public function walkHavingClause($havingClause) |
|
1115 | |||
1116 | /** |
||
1117 | * {@inheritdoc} |
||
1118 | */ |
||
1119 | 224 | public function walkJoin($join) |
|
1120 | { |
||
1121 | 224 | $joinType = $join->joinType; |
|
1122 | 224 | $joinDeclaration = $join->joinAssociationDeclaration; |
|
1123 | |||
1124 | 224 | $sql = ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) |
|
1125 | 49 | ? ' LEFT JOIN ' |
|
1126 | 224 | : ' INNER JOIN '; |
|
1127 | |||
1128 | switch (true) { |
||
1129 | 224 | case ($joinDeclaration instanceof \Doctrine\ORM\Query\AST\RangeVariableDeclaration): |
|
1130 | 16 | $class = $this->em->getClassMetadata($joinDeclaration->abstractSchemaName); |
|
1131 | 16 | $dqlAlias = $joinDeclaration->aliasIdentificationVariable; |
|
1132 | 16 | $tableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias); |
|
1133 | 16 | $conditions = []; |
|
1134 | |||
1135 | 16 | if ($join->conditionalExpression) { |
|
1136 | 14 | $conditions[] = '(' . $this->walkConditionalExpression($join->conditionalExpression) . ')'; |
|
1137 | } |
||
1138 | |||
1139 | 16 | $condExprConjunction = ($class->isInheritanceTypeJoined() && $joinType != AST\Join::JOIN_TYPE_LEFT && $joinType != AST\Join::JOIN_TYPE_LEFTOUTER) |
|
1140 | 3 | ? ' AND ' |
|
1141 | 16 | : ' ON '; |
|
1142 | |||
1143 | 16 | $sql .= $this->walkRangeVariableDeclaration($joinDeclaration); |
|
1144 | |||
1145 | // Apply remaining inheritance restrictions |
||
1146 | 16 | $discrSql = $this->_generateDiscriminatorColumnConditionSQL([$dqlAlias]); |
|
1147 | |||
1148 | 16 | if ($discrSql) { |
|
1149 | 3 | $conditions[] = $discrSql; |
|
1150 | } |
||
1151 | |||
1152 | // Apply the filters |
||
1153 | 16 | $filterExpr = $this->generateFilterConditionSQL($class, $tableAlias); |
|
1154 | |||
1155 | 16 | if ($filterExpr) { |
|
1156 | $conditions[] = $filterExpr; |
||
1157 | } |
||
1158 | |||
1159 | 16 | if ($conditions) { |
|
1160 | 14 | $sql .= $condExprConjunction . implode(' AND ', $conditions); |
|
1161 | } |
||
1162 | |||
1163 | 16 | break; |
|
1164 | |||
1165 | 208 | case ($joinDeclaration instanceof \Doctrine\ORM\Query\AST\JoinAssociationDeclaration): |
|
1166 | 208 | $sql .= $this->walkJoinAssociationDeclaration($joinDeclaration, $joinType, $join->conditionalExpression); |
|
1167 | 206 | break; |
|
1168 | } |
||
1169 | |||
1170 | 222 | return $sql; |
|
1171 | } |
||
1172 | |||
1173 | /** |
||
1174 | * Walks down a CoalesceExpression AST node and generates the corresponding SQL. |
||
1175 | * |
||
1176 | * @param AST\CoalesceExpression $coalesceExpression |
||
1177 | * |
||
1178 | * @return string The SQL. |
||
1179 | */ |
||
1180 | 2 | public function walkCoalesceExpression($coalesceExpression) |
|
1194 | |||
1195 | /** |
||
1196 | * Walks down a NullIfExpression AST node and generates the corresponding SQL. |
||
1197 | * |
||
1198 | * @param AST\NullIfExpression $nullIfExpression |
||
1199 | * |
||
1200 | * @return string The SQL. |
||
1201 | */ |
||
1202 | 3 | public function walkNullIfExpression($nullIfExpression) |
|
1214 | |||
1215 | /** |
||
1216 | * Walks down a GeneralCaseExpression AST node and generates the corresponding SQL. |
||
1217 | * |
||
1218 | * @param AST\GeneralCaseExpression $generalCaseExpression |
||
1219 | * |
||
1220 | * @return string The SQL. |
||
1221 | */ |
||
1222 | 8 | public function walkGeneralCaseExpression(AST\GeneralCaseExpression $generalCaseExpression) |
|
1235 | |||
1236 | /** |
||
1237 | * Walks down a SimpleCaseExpression AST node and generates the corresponding SQL. |
||
1238 | * |
||
1239 | * @param AST\SimpleCaseExpression $simpleCaseExpression |
||
1240 | * |
||
1241 | * @return string The SQL. |
||
1242 | */ |
||
1243 | 5 | public function walkSimpleCaseExpression($simpleCaseExpression) |
|
1256 | |||
1257 | /** |
||
1258 | * {@inheritdoc} |
||
1259 | */ |
||
1260 | 561 | public function walkSelectExpression($selectExpression) |
|
1261 | { |
||
1262 | 561 | $sql = ''; |
|
1263 | 561 | $expr = $selectExpression->expression; |
|
1264 | 561 | $hidden = $selectExpression->hiddenAliasResultVariable; |
|
1265 | |||
1266 | switch (true) { |
||
1267 | 561 | case ($expr instanceof AST\PathExpression): |
|
1268 | 91 | if ($expr->type !== AST\PathExpression::TYPE_STATE_FIELD) { |
|
1269 | throw QueryException::invalidPathExpression($expr); |
||
1270 | } |
||
1271 | |||
1272 | 91 | $fieldName = $expr->field; |
|
1273 | 91 | $dqlAlias = $expr->identificationVariable; |
|
1274 | 91 | $qComp = $this->queryComponents[$dqlAlias]; |
|
1275 | 91 | $class = $qComp['metadata']; |
|
1276 | |||
1277 | 91 | $resultAlias = $selectExpression->fieldIdentificationVariable ?: $fieldName; |
|
1278 | 91 | $tableName = ($class->isInheritanceTypeJoined()) |
|
1279 | 8 | ? $this->em->getUnitOfWork()->getEntityPersister($class->name)->getOwningTable($fieldName) |
|
1280 | 91 | : $class->getTableName(); |
|
1281 | |||
1282 | 91 | $sqlTableAlias = $this->getSQLTableAlias($tableName, $dqlAlias); |
|
1283 | 91 | $fieldMapping = $class->fieldMappings[$fieldName]; |
|
1284 | 91 | $columnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
1285 | 91 | $columnAlias = $this->getSQLColumnAlias($fieldMapping['columnName']); |
|
1286 | 91 | $col = $sqlTableAlias . '.' . $columnName; |
|
1287 | |||
1288 | 91 | if (isset($fieldMapping['requireSQLConversion'])) { |
|
1289 | 2 | $type = Type::getType($fieldMapping['type']); |
|
1290 | 2 | $col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); |
|
1291 | } |
||
1292 | |||
1293 | 91 | $sql .= $col . ' AS ' . $columnAlias; |
|
1294 | |||
1295 | 91 | $this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
|
1296 | |||
1297 | 91 | if ( ! $hidden) { |
|
1298 | 91 | $this->rsm->addScalarResult($columnAlias, $resultAlias, $fieldMapping['type']); |
|
1299 | 91 | $this->scalarFields[$dqlAlias][$fieldName] = $columnAlias; |
|
1300 | } |
||
1301 | |||
1302 | 91 | break; |
|
1303 | |||
1304 | 511 | case ($expr instanceof AST\AggregateExpression): |
|
1305 | 503 | case ($expr instanceof AST\Functions\FunctionNode): |
|
1306 | 490 | case ($expr instanceof AST\SimpleArithmeticExpression): |
|
1307 | 490 | case ($expr instanceof AST\ArithmeticTerm): |
|
1308 | 490 | case ($expr instanceof AST\ArithmeticFactor): |
|
1309 | 489 | case ($expr instanceof AST\ParenthesisExpression): |
|
1310 | 488 | case ($expr instanceof AST\Literal): |
|
1311 | 487 | case ($expr instanceof AST\NullIfExpression): |
|
1312 | 486 | case ($expr instanceof AST\CoalesceExpression): |
|
1313 | 485 | case ($expr instanceof AST\GeneralCaseExpression): |
|
1314 | 481 | case ($expr instanceof AST\SimpleCaseExpression): |
|
1315 | 58 | $columnAlias = $this->getSQLColumnAlias('sclr'); |
|
1316 | 58 | $resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
|
1317 | |||
1318 | 58 | $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1319 | |||
1320 | 58 | $this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
|
1321 | |||
1322 | 58 | if ( ! $hidden) { |
|
1323 | // We cannot resolve field type here; assume 'string'. |
||
1324 | 58 | $this->rsm->addScalarResult($columnAlias, $resultAlias, 'string'); |
|
1325 | } |
||
1326 | 58 | break; |
|
1327 | |||
1328 | 480 | case ($expr instanceof AST\Subselect): |
|
1329 | 4 | $columnAlias = $this->getSQLColumnAlias('sclr'); |
|
1330 | 4 | $resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
|
1331 | |||
1332 | 4 | $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1333 | |||
1334 | 4 | $this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
|
1335 | |||
1336 | 4 | if ( ! $hidden) { |
|
1337 | // We cannot resolve field type here; assume 'string'. |
||
1338 | 4 | $this->rsm->addScalarResult($columnAlias, $resultAlias, 'string'); |
|
1339 | } |
||
1340 | 4 | break; |
|
1341 | |||
1342 | 480 | case ($expr instanceof AST\NewObjectExpression): |
|
1343 | 20 | $sql .= $this->walkNewObject($expr,$selectExpression->fieldIdentificationVariable); |
|
1344 | 20 | break; |
|
1345 | |||
1346 | default: |
||
1347 | // IdentificationVariable or PartialObjectExpression |
||
1348 | 460 | if ($expr instanceof AST\PartialObjectExpression) { |
|
1349 | 16 | $dqlAlias = $expr->identificationVariable; |
|
1350 | 16 | $partialFieldSet = $expr->partialFieldSet; |
|
1351 | } else { |
||
1352 | 455 | $dqlAlias = $expr; |
|
1353 | 455 | $partialFieldSet = []; |
|
1354 | } |
||
1355 | |||
1356 | 460 | $queryComp = $this->queryComponents[$dqlAlias]; |
|
1357 | 460 | $class = $queryComp['metadata']; |
|
1358 | 460 | $resultAlias = $selectExpression->fieldIdentificationVariable ?: null; |
|
1359 | |||
1360 | 460 | if ( ! isset($this->selectedClasses[$dqlAlias])) { |
|
1361 | 460 | $this->selectedClasses[$dqlAlias] = [ |
|
1362 | 460 | 'class' => $class, |
|
1363 | 460 | 'dqlAlias' => $dqlAlias, |
|
1364 | 460 | 'resultAlias' => $resultAlias |
|
1365 | ]; |
||
1366 | } |
||
1367 | |||
1368 | 460 | $sqlParts = []; |
|
1369 | |||
1370 | // Select all fields from the queried class |
||
1371 | 460 | foreach ($class->fieldMappings as $fieldName => $mapping) { |
|
1372 | 459 | if ($partialFieldSet && ! in_array($fieldName, $partialFieldSet)) { |
|
1373 | 14 | continue; |
|
1374 | } |
||
1375 | |||
1376 | 458 | $tableName = (isset($mapping['inherited'])) |
|
1377 | 51 | ? $this->em->getClassMetadata($mapping['inherited'])->getTableName() |
|
1378 | 458 | : $class->getTableName(); |
|
1379 | |||
1380 | 458 | $sqlTableAlias = $this->getSQLTableAlias($tableName, $dqlAlias); |
|
1381 | 458 | $columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
|
1382 | 458 | $quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
1383 | |||
1384 | 458 | $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1385 | |||
1386 | 458 | if (isset($mapping['requireSQLConversion'])) { |
|
1387 | 5 | $type = Type::getType($mapping['type']); |
|
1388 | 5 | $col = $type->convertToPHPValueSQL($col, $this->platform); |
|
1389 | } |
||
1390 | |||
1391 | 458 | $sqlParts[] = $col . ' AS '. $columnAlias; |
|
1392 | |||
1393 | 458 | $this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
|
1394 | |||
1395 | 458 | $this->rsm->addFieldResult($dqlAlias, $columnAlias, $fieldName, $class->name); |
|
1396 | } |
||
1397 | |||
1398 | // Add any additional fields of subclasses (excluding inherited fields) |
||
1399 | // 1) on Single Table Inheritance: always, since its marginal overhead |
||
1400 | // 2) on Class Table Inheritance only if partial objects are disallowed, |
||
1401 | // since it requires outer joining subtables. |
||
1402 | 460 | if ($class->isInheritanceTypeSingleTable() || ! $this->query->getHint(Query::HINT_FORCE_PARTIAL_LOAD)) { |
|
1403 | 370 | foreach ($class->subClasses as $subClassName) { |
|
1404 | 42 | $subClass = $this->em->getClassMetadata($subClassName); |
|
1405 | 42 | $sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
|
1406 | |||
1407 | 42 | foreach ($subClass->fieldMappings as $fieldName => $mapping) { |
|
1408 | 42 | if (isset($mapping['inherited']) || ($partialFieldSet && !in_array($fieldName, $partialFieldSet))) { |
|
1409 | 42 | continue; |
|
1410 | } |
||
1411 | |||
1412 | 34 | $columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
|
1413 | 34 | $quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $subClass, $this->platform); |
|
1414 | |||
1415 | 34 | $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1416 | |||
1417 | 34 | if (isset($mapping['requireSQLConversion'])) { |
|
1418 | $type = Type::getType($mapping['type']); |
||
1419 | $col = $type->convertToPHPValueSQL($col, $this->platform); |
||
1420 | } |
||
1421 | |||
1422 | 34 | $sqlParts[] = $col . ' AS ' . $columnAlias; |
|
1423 | |||
1424 | 34 | $this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
|
1425 | |||
1426 | 42 | $this->rsm->addFieldResult($dqlAlias, $columnAlias, $fieldName, $subClassName); |
|
1427 | } |
||
1428 | } |
||
1429 | } |
||
1430 | |||
1431 | 460 | $sql .= implode(', ', $sqlParts); |
|
1432 | } |
||
1433 | |||
1434 | 561 | return $sql; |
|
1435 | } |
||
1436 | |||
1437 | /** |
||
1438 | * {@inheritdoc} |
||
1439 | */ |
||
1440 | public function walkQuantifiedExpression($qExpr) |
||
1444 | |||
1445 | /** |
||
1446 | * {@inheritdoc} |
||
1447 | */ |
||
1448 | 17 | public function walkSubselect($subselect) |
|
1469 | |||
1470 | /** |
||
1471 | * {@inheritdoc} |
||
1472 | */ |
||
1473 | 17 | public function walkSubselectFromClause($subselectFromClause) |
|
1484 | |||
1485 | /** |
||
1486 | * {@inheritdoc} |
||
1487 | */ |
||
1488 | 17 | public function walkSimpleSelectClause($simpleSelectClause) |
|
1493 | |||
1494 | /** |
||
1495 | * @param \Doctrine\ORM\Query\AST\ParenthesisExpression $parenthesisExpression |
||
1496 | * |
||
1497 | * @return string. |
||
1498 | */ |
||
1499 | 18 | public function walkParenthesisExpression(AST\ParenthesisExpression $parenthesisExpression) |
|
1503 | |||
1504 | /** |
||
1505 | * @param AST\NewObjectExpression $newObjectExpression |
||
1506 | * @param null|string $newObjectResultAlias |
||
1507 | * @return string The SQL. |
||
1508 | */ |
||
1509 | 20 | public function walkNewObject($newObjectExpression, $newObjectResultAlias=null) |
|
1568 | |||
1569 | /** |
||
1570 | * {@inheritdoc} |
||
1571 | */ |
||
1572 | 17 | public function walkSimpleSelectExpression($simpleSelectExpression) |
|
1573 | { |
||
1619 | |||
1620 | /** |
||
1621 | * {@inheritdoc} |
||
1622 | */ |
||
1623 | 10 | public function walkAggregateExpression($aggExpression) |
|
1628 | |||
1629 | /** |
||
1630 | * {@inheritdoc} |
||
1631 | */ |
||
1632 | 7 | public function walkGroupByClause($groupByClause) |
|
1642 | |||
1643 | /** |
||
1644 | * {@inheritdoc} |
||
1645 | */ |
||
1646 | 7 | public function walkGroupByItem($groupByItem) |
|
1689 | |||
1690 | /** |
||
1691 | * {@inheritdoc} |
||
1692 | */ |
||
1693 | 36 | public function walkDeleteClause(AST\DeleteClause $deleteClause) |
|
1704 | |||
1705 | /** |
||
1706 | * {@inheritdoc} |
||
1707 | */ |
||
1708 | 25 | public function walkUpdateClause($updateClause) |
|
1721 | |||
1722 | /** |
||
1723 | * {@inheritdoc} |
||
1724 | */ |
||
1725 | 28 | public function walkUpdateItem($updateItem) |
|
1751 | |||
1752 | /** |
||
1753 | * {@inheritdoc} |
||
1754 | */ |
||
1755 | 618 | public function walkWhereClause($whereClause) |
|
1790 | |||
1791 | /** |
||
1792 | * {@inheritdoc} |
||
1793 | */ |
||
1794 | 334 | public function walkConditionalExpression($condExpr) |
|
1804 | |||
1805 | /** |
||
1806 | * {@inheritdoc} |
||
1807 | */ |
||
1808 | 334 | public function walkConditionalTerm($condTerm) |
|
1818 | |||
1819 | /** |
||
1820 | * {@inheritdoc} |
||
1821 | */ |
||
1822 | 334 | public function walkConditionalFactor($factor) |
|
1830 | |||
1831 | /** |
||
1832 | * {@inheritdoc} |
||
1833 | */ |
||
1834 | 334 | public function walkConditionalPrimary($primary) |
|
1846 | |||
1847 | /** |
||
1848 | * {@inheritdoc} |
||
1849 | */ |
||
1850 | 5 | public function walkExistsExpression($existsExpr) |
|
1858 | |||
1859 | /** |
||
1860 | * {@inheritdoc} |
||
1861 | */ |
||
1862 | 6 | public function walkCollectionMemberExpression($collMemberExpr) |
|
1968 | |||
1969 | /** |
||
1970 | * {@inheritdoc} |
||
1971 | */ |
||
1972 | 3 | public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr) |
|
1979 | |||
1980 | /** |
||
1981 | * {@inheritdoc} |
||
1982 | */ |
||
1983 | 9 | public function walkNullComparisonExpression($nullCompExpr) |
|
2000 | |||
2001 | /** |
||
2002 | * {@inheritdoc} |
||
2003 | */ |
||
2004 | 80 | public function walkInExpression($inExpr) |
|
2016 | |||
2017 | /** |
||
2018 | * {@inheritdoc} |
||
2019 | */ |
||
2020 | 9 | public function walkInstanceOfExpression($instanceOfExpr) |
|
2069 | |||
2070 | /** |
||
2071 | * {@inheritdoc} |
||
2072 | */ |
||
2073 | 72 | public function walkInParameter($inParam) |
|
2079 | |||
2080 | /** |
||
2081 | * {@inheritdoc} |
||
2082 | */ |
||
2083 | 125 | public function walkLiteral($literal) |
|
2099 | |||
2100 | /** |
||
2101 | * {@inheritdoc} |
||
2102 | */ |
||
2103 | 6 | public function walkBetweenExpression($betweenExpr) |
|
2116 | |||
2117 | /** |
||
2118 | * {@inheritdoc} |
||
2119 | */ |
||
2120 | 9 | public function walkLikeExpression($likeExpr) |
|
2145 | |||
2146 | /** |
||
2147 | * {@inheritdoc} |
||
2148 | */ |
||
2149 | 5 | public function walkStateFieldPathExpression($stateFieldPathExpression) |
|
2153 | |||
2154 | /** |
||
2155 | * {@inheritdoc} |
||
2156 | */ |
||
2157 | 232 | public function walkComparisonExpression($compExpr) |
|
2175 | |||
2176 | /** |
||
2177 | * {@inheritdoc} |
||
2178 | */ |
||
2179 | 208 | public function walkInputParameter($inputParam) |
|
2191 | |||
2192 | /** |
||
2193 | * {@inheritdoc} |
||
2194 | */ |
||
2195 | 298 | public function walkArithmeticExpression($arithmeticExpr) |
|
2201 | |||
2202 | /** |
||
2203 | * {@inheritdoc} |
||
2204 | */ |
||
2205 | 326 | public function walkSimpleArithmeticExpression($simpleArithmeticExpr) |
|
2213 | |||
2214 | /** |
||
2215 | * {@inheritdoc} |
||
2216 | */ |
||
2217 | 347 | public function walkArithmeticTerm($term) |
|
2233 | |||
2234 | /** |
||
2235 | * {@inheritdoc} |
||
2236 | */ |
||
2237 | 347 | public function walkArithmeticFactor($factor) |
|
2255 | |||
2256 | /** |
||
2257 | * Walks down an ArithmeticPrimary that represents an AST node, thereby generating the appropriate SQL. |
||
2258 | * |
||
2259 | * @param mixed $primary |
||
2260 | * |
||
2261 | * @return string The SQL. |
||
2262 | */ |
||
2263 | 347 | public function walkArithmeticPrimary($primary) |
|
2275 | |||
2276 | /** |
||
2277 | * {@inheritdoc} |
||
2278 | */ |
||
2279 | 17 | public function walkStringPrimary($stringPrimary) |
|
2285 | |||
2286 | /** |
||
2287 | * {@inheritdoc} |
||
2288 | */ |
||
2289 | 11 | public function walkResultVariable($resultVariable) |
|
2299 | } |
||
2300 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.