2013-10-15 19:56:33 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2013-10-15 19:56:33 +02:00
|
|
|
|
|
|
|
namespace Icinga\Data;
|
|
|
|
|
2014-06-06 08:12:17 +02:00
|
|
|
use Icinga\Application\Icinga;
|
|
|
|
use Icinga\Data\Filter\Filter;
|
2013-10-15 19:56:33 +02:00
|
|
|
use Icinga\Web\Paginator\Adapter\QueryAdapter;
|
2014-06-06 08:12:17 +02:00
|
|
|
use Zend_Paginator;
|
|
|
|
use Exception;
|
2014-08-27 16:03:15 +02:00
|
|
|
use Icinga\Exception\IcingaException;
|
2013-10-15 19:56:33 +02:00
|
|
|
|
2014-06-06 08:12:17 +02:00
|
|
|
class SimpleQuery implements QueryInterface, Queryable
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Query data source
|
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @var mixed
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
|
|
|
protected $ds;
|
|
|
|
|
2014-06-06 08:12:17 +02:00
|
|
|
/**
|
|
|
|
* The table you are going to query
|
|
|
|
*/
|
|
|
|
protected $table;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The columns you asked for
|
|
|
|
*
|
|
|
|
* All columns if null, no column if empty??? Alias handling goes here!
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $desiredColumns = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The columns you are interested in
|
|
|
|
*
|
|
|
|
* All columns if null, no column if empty??? Alias handling goes here!
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $columns = array();
|
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
/**
|
|
|
|
* The columns you're using to sort the query result
|
2014-04-15 16:40:25 +02:00
|
|
|
*
|
2013-10-15 19:56:33 +02:00
|
|
|
* @var array
|
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
protected $order = array();
|
2013-10-15 19:56:33 +02:00
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Number of rows to return
|
|
|
|
*
|
2013-10-15 19:56:33 +02:00
|
|
|
* @var int
|
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
protected $limitCount;
|
2013-10-15 19:56:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Result starts with this row
|
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @var int
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
protected $limitOffset;
|
2013-10-15 19:56:33 +02:00
|
|
|
|
2014-06-06 08:12:17 +02:00
|
|
|
protected $filter;
|
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param mixed $ds
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-06-06 08:12:17 +02:00
|
|
|
public function __construct($ds, $columns = null)
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
|
|
|
$this->ds = $ds;
|
2014-06-06 08:12:17 +02:00
|
|
|
$this->filter = Filter::matchAll();
|
|
|
|
if ($columns !== null) {
|
|
|
|
$this->desiredColumns = $columns;
|
|
|
|
}
|
2013-10-15 19:56:33 +02:00
|
|
|
$this->init();
|
2014-06-06 08:12:17 +02:00
|
|
|
if ($this->desiredColumns !== null) {
|
|
|
|
$this->columns($this->desiredColumns);
|
|
|
|
}
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Initialize query
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* Overwrite this instead of __construct (it's called at the end of the construct) to
|
|
|
|
* implement custom initialization logic on construction time
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-06-06 08:12:17 +02:00
|
|
|
protected function init() {}
|
2013-10-15 19:56:33 +02:00
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Get the data source
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return mixed
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function getDatasource()
|
2013-10-17 21:40:02 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds;
|
2013-10-17 21:40:02 +02:00
|
|
|
}
|
2013-10-15 19:56:33 +02:00
|
|
|
|
|
|
|
/**
|
2014-06-06 08:12:17 +02:00
|
|
|
* Choose a table and the colums you are interested in
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-06-06 08:12:17 +02:00
|
|
|
* Query will return all available columns if none are given here
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2015-04-07 14:23:26 +02:00
|
|
|
* @return $this
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-06-06 08:12:17 +02:00
|
|
|
public function from($target, array $fields = null)
|
|
|
|
{
|
|
|
|
$this->target = $target;
|
|
|
|
if ($fields !== null) {
|
|
|
|
$this->columns($fields);
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
2013-10-15 19:56:33 +02:00
|
|
|
|
|
|
|
/**
|
2014-06-06 08:12:17 +02:00
|
|
|
* Add a where condition to the query by and
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* The syntax of the condition and valid values are defined by the concrete backend-specific query implementation.
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param string $condition
|
|
|
|
* @param mixed $value
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2015-04-07 14:23:26 +02:00
|
|
|
* @return $this
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-06-06 08:12:17 +02:00
|
|
|
public function where($condition, $value = null)
|
|
|
|
{
|
2014-06-17 14:34:02 +02:00
|
|
|
// TODO: more intelligence please
|
|
|
|
$this->filter->addFilter(Filter::expression($condition, '=', $value));
|
2014-06-06 08:12:17 +02:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFilter()
|
|
|
|
{
|
|
|
|
return $this->filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function applyFilter(Filter $filter)
|
|
|
|
{
|
|
|
|
return $this->addFilter($filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addFilter(Filter $filter)
|
|
|
|
{
|
|
|
|
$this->filter->addFilter($filter);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setFilter(Filter $filter)
|
|
|
|
{
|
|
|
|
$this->filter = $filter;
|
|
|
|
return $this;
|
|
|
|
}
|
2013-10-15 19:56:33 +02:00
|
|
|
|
2014-04-15 16:40:25 +02:00
|
|
|
public function setOrderColumns(array $orderColumns)
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-08-27 16:03:15 +02:00
|
|
|
throw new IcingaException('This function does nothing and will be removed');
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
2015-03-13 17:09:32 +01:00
|
|
|
/**
|
|
|
|
* Split order field into its field and sort direction
|
|
|
|
*
|
|
|
|
* @param string $field
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function splitOrder($field)
|
|
|
|
{
|
|
|
|
$fieldAndDirection = explode(' ', $field, 2);
|
|
|
|
if (count($fieldAndDirection) === 1) {
|
|
|
|
$direction = null;
|
|
|
|
} else {
|
|
|
|
$field = $fieldAndDirection[0];
|
|
|
|
$direction = (strtoupper(trim($fieldAndDirection[1])) === 'DESC') ?
|
|
|
|
Sortable::SORT_DESC : Sortable::SORT_ASC;
|
|
|
|
}
|
|
|
|
return array($field, $direction);
|
|
|
|
}
|
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Sort result set by the given field (and direction)
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
|
|
|
* Preferred usage:
|
|
|
|
* <code>
|
2014-04-15 16:40:25 +02:00
|
|
|
* $query->order('field, 'ASC')
|
2013-10-15 19:56:33 +02:00
|
|
|
* </code>
|
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param string $field
|
2014-05-07 10:00:41 +02:00
|
|
|
* @param string $direction
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2015-04-07 14:23:26 +02:00
|
|
|
* @return $this
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function order($field, $direction = null)
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
if ($direction === null) {
|
2015-03-13 17:09:32 +01:00
|
|
|
list($field, $direction) = $this->splitOrder($field);
|
|
|
|
if ($direction === null) {
|
|
|
|
$direction = Sortable::SORT_ASC;
|
2014-04-15 16:40:25 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (($direction = strtoupper($direction))) {
|
|
|
|
case Sortable::SORT_ASC:
|
|
|
|
case Sortable::SORT_DESC:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$direction = Sortable::SORT_ASC;
|
|
|
|
break;
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-15 16:40:25 +02:00
|
|
|
$this->order[] = array($field, $direction);
|
2013-10-15 19:56:33 +02:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-06-06 08:12:17 +02:00
|
|
|
public function compare($a, $b, $col_num = 0)
|
|
|
|
{
|
|
|
|
// Last column to sort reached, rows are considered being equal
|
|
|
|
if (! array_key_exists($col_num, $this->order)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
$col = $this->order[$col_num][0];
|
|
|
|
$dir = $this->order[$col_num][1];
|
|
|
|
// TODO: throw Exception if column is missing
|
|
|
|
//$res = strnatcmp(strtolower($a->$col), strtolower($b->$col));
|
2014-11-16 18:24:16 +01:00
|
|
|
$res = @strcmp(strtolower($a->$col), strtolower($b->$col));
|
2014-06-06 08:12:17 +02:00
|
|
|
if ($res === 0) {
|
|
|
|
// return $this->compare($a, $b, $col_num++);
|
|
|
|
|
|
|
|
if (array_key_exists(++$col_num, $this->order)) {
|
|
|
|
return $this->compare($a, $b, $col_num);
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($dir === self::SORT_ASC) {
|
|
|
|
return $res;
|
|
|
|
} else {
|
|
|
|
return $res * -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-20 13:21:18 +01:00
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Whether an order is set
|
2014-03-20 13:21:18 +01:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return bool
|
2014-03-20 13:21:18 +01:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function hasOrder()
|
2014-03-20 13:21:18 +01:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return !empty($this->order);
|
2014-03-20 13:21:18 +01:00
|
|
|
}
|
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Get the order if any
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return array|null
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function getOrder()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->order;
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Set a limit count and offset to the query
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param int $count Number of rows to return
|
|
|
|
* @param int $offset Start returning after this many rows
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2015-04-07 14:23:26 +02:00
|
|
|
* @return $this
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
|
|
|
public function limit($count = null, $offset = null)
|
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
$this->limitCount = $count !== null ? (int) $count : null;
|
|
|
|
$this->limitOffset = (int) $offset;
|
2014-03-13 15:15:56 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Whether a limit is set
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return bool
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
|
|
|
public function hasLimit()
|
|
|
|
{
|
|
|
|
return $this->limitCount !== null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Get the limit if any
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return int|null
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
|
|
|
public function getLimit()
|
|
|
|
{
|
|
|
|
return $this->limitCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Whether an offset is set
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return bool
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function hasOffset()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->limitOffset > 0;
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Get the offset if any
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return int|null
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function getOffset()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->limitOffset;
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Paginate data
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* Auto-detects pagination parameters from request when unset
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param int $itemsPerPage Number of items per page
|
|
|
|
* @param int $pageNumber Current page number
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return Zend_Paginator
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function paginate($itemsPerPage = null, $pageNumber = null)
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
if ($itemsPerPage === null || $pageNumber === null) {
|
|
|
|
// Detect parameters from request
|
2014-06-06 07:48:29 +02:00
|
|
|
$request = Icinga::app()->getFrontController()->getRequest();
|
2014-04-15 16:40:25 +02:00
|
|
|
if ($itemsPerPage === null) {
|
2015-02-02 14:15:09 +01:00
|
|
|
$itemsPerPage = $request->getParam('limit', 25);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
2014-04-15 16:40:25 +02:00
|
|
|
if ($pageNumber === null) {
|
|
|
|
$pageNumber = $request->getParam('page', 0);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-15 16:40:25 +02:00
|
|
|
$this->limit($itemsPerPage, $pageNumber * $itemsPerPage);
|
2013-10-15 19:56:33 +02:00
|
|
|
$paginator = new Zend_Paginator(new QueryAdapter($this));
|
2014-04-15 16:40:25 +02:00
|
|
|
$paginator->setItemCountPerPage($itemsPerPage);
|
|
|
|
$paginator->setCurrentPageNumber($pageNumber);
|
2013-10-15 19:56:33 +02:00
|
|
|
return $paginator;
|
|
|
|
}
|
|
|
|
|
2013-10-19 20:09:17 +02:00
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Retrieve an array containing all rows of the result set
|
2013-10-19 20:09:17 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return array
|
2013-10-19 20:09:17 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function fetchAll()
|
2013-10-19 20:09:17 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds->fetchAll($this);
|
2013-10-19 20:09:17 +02:00
|
|
|
}
|
|
|
|
|
2013-10-15 19:56:33 +02:00
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Fetch the first row of the result set
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return mixed
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function fetchRow()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds->fetchRow($this);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Fetch a column of all rows of the result set as an array
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param int $columnIndex Index of the column to fetch
|
|
|
|
*
|
|
|
|
* @return array
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function fetchColumn($columnIndex = 0)
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds->fetchColumn($this, $columnIndex);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Fetch the first column of the first row of the result set
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return string
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function fetchOne()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds->fetchOne($this);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Fetch all rows of the result set as an array of key-value pairs
|
|
|
|
*
|
|
|
|
* The first column is the key, the second column is the value.
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function fetchPairs()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds->fetchPairs($this);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Count all rows of the result set
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @return int
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-04-15 16:40:25 +02:00
|
|
|
public function count()
|
2013-10-15 19:56:33 +02:00
|
|
|
{
|
2014-04-15 16:40:25 +02:00
|
|
|
return $this->ds->count($this);
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-04-15 16:40:25 +02:00
|
|
|
* Set columns
|
2013-10-15 19:56:33 +02:00
|
|
|
*
|
2014-04-15 16:40:25 +02:00
|
|
|
* @param array $columns
|
|
|
|
*
|
2015-04-07 14:23:26 +02:00
|
|
|
* @return $this
|
2013-10-15 19:56:33 +02:00
|
|
|
*/
|
2014-06-06 07:49:39 +02:00
|
|
|
public function columns(array $columns)
|
|
|
|
{
|
|
|
|
$this->columns = $columns;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColumns()
|
|
|
|
{
|
|
|
|
return $this->columns;
|
|
|
|
}
|
2013-10-15 19:56:33 +02:00
|
|
|
}
|