<?php
namespace ProjectBiz\DatabaseBundle\Database\Criteria;
use Doctrine\DBAL\Query\QueryBuilder;
class CriteriaConstant implements CriteriaBuilderInterface, \JsonSerializable
{
private $value;
public function __construct($value)
{
$this->value = $value;
}
public function buildCriteria(QueryBuilder $builder, array $columnMap, $processedView, $mt_name = 'mt')
{
return $builder->createNamedParameter($this->value);
}
/**
* (PHP 5 >= 5.4.0)<br/>
* Specify data which should be serialized to JSON
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
*/
public function jsonSerialize()
{
return [
'type' => 'constant',
'value' => $this->value
];
}
}