Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ColumnsRenderer.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  protected $quote;
20 
24  public function __construct(
26  ) {
27  $this->quote = $quote;
28  }
29 
38  public function render(Select $select, $sql = '')
39  {
40  if (!count($select->getPart(Select::COLUMNS))) {
41  return null;
42  }
43  $columns = [];
44  foreach ($select->getPart(Select::COLUMNS) as $columnEntry) {
45  list($correlationName, $column, $alias) = $columnEntry;
46  if ($column instanceof \Zend_Db_Expr) {
47  $columns[] = $this->quote->quoteColumnAs($column, $alias);
48  } else {
49  if ($column == Select::SQL_WILDCARD) {
50  $column = new \Zend_Db_Expr(Select::SQL_WILDCARD);
51  $alias = null;
52  }
53  if (empty($correlationName)) {
54  $columns[] = $this->quote->quoteColumnAs($column, $alias);
55  } else {
56  $columns[] = $this->quote->quoteColumnAs([$correlationName, $column], $alias);
57  }
58  }
59  }
60  return $sql . ' ' . implode(', ', $columns);
61  }
62 }
$columns
Definition: default.phtml:15
const SQL_WILDCARD
Definition: Select.php:66
const COLUMNS
Definition: Select.php:48
if(!trim($html)) $alias
Definition: details.phtml:20