/** * @param QOM\OrderingInterface $ordering * * @return string */ public function walkOrdering(QOM\OrderingInterface $ordering) { $direction = $ordering->getOrder(); if ($direction === QOM\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING) { $direction = 'ASC'; } elseif ($direction === QOM\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING) { $direction = 'DESC'; } $sql = $this->walkOperand($ordering->getOperand()); if ($ordering->getOperand() instanceof QOM\PropertyValueInterface) { $operand = $ordering->getOperand(); $property = $ordering->getOperand()->getPropertyName(); if ($property !== 'jcr:path' && $property !== 'jcr:uuid') { $alias = $this->getTableAlias($operand->getSelectorName() . '.' . $property); $numericalSelector = $this->sqlXpathExtractValue($alias, $property, 'numerical_props'); $sql = sprintf('CAST(%s AS DECIMAL) %s, %s', $numericalSelector, $direction, $sql); } } $sql .= ' ' . $direction; return $sql; }
/** * @param QOM\OrderingInterface $ordering * * @return string */ public function walkOrdering(QOM\OrderingInterface $ordering) { $direction = $ordering->getOrder(); if ($direction === QOM\QueryObjectModelConstantsInterface::JCR_ORDER_ASCENDING) { $direction = 'ASC'; } elseif ($direction === QOM\QueryObjectModelConstantsInterface::JCR_ORDER_DESCENDING) { $direction = 'DESC'; } return $this->walkOperand($ordering->getOperand()) . " " . $direction; }