QueryExpressionBuilder.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\db;
  8. /**
  9. * Class QueryExpressionBuilder is used internally to build [[Query]] object
  10. * using unified [[QueryBuilder]] expression building interface.
  11. *
  12. * @author Dmytro Naumenko <d.naumenko.a@gmail.com>
  13. * @since 2.0.14
  14. */
  15. class QueryExpressionBuilder implements ExpressionBuilderInterface
  16. {
  17. use ExpressionBuilderTrait;
  18. /**
  19. * Method builds the raw SQL from the $expression that will not be additionally
  20. * escaped or quoted.
  21. *
  22. * @param ExpressionInterface|Query $expression the expression to be built.
  23. * @param array $params the binding parameters.
  24. * @return string the raw SQL that will not be additionally escaped or quoted.
  25. */
  26. public function build(ExpressionInterface $expression, array &$params = [])
  27. {
  28. list($sql, $params) = $this->queryBuilder->build($expression, $params);
  29. return "($sql)";
  30. }
  31. }