3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Db\Sql\Predicate
;
12 class Between
implements PredicateInterface
14 protected $specification = '%1$s BETWEEN %2$s AND %3$s';
15 protected $identifier = null;
16 protected $minValue = null;
17 protected $maxValue = null;
22 * @param string $identifier
23 * @param int|float|string $minValue
24 * @param int|float|string $maxValue
26 public function __construct($identifier = null, $minValue = null, $maxValue = null)
29 $this->setIdentifier($identifier);
31 if ($minValue !== null) {
32 $this->setMinValue($minValue);
34 if ($maxValue !== null) {
35 $this->setMaxValue($maxValue);
40 * Set identifier for comparison
42 * @param string $identifier
45 public function setIdentifier($identifier)
47 $this->identifier
= $identifier;
52 * Get identifier of comparison
56 public function getIdentifier()
58 return $this->identifier
;
62 * Set minimum boundary for comparison
64 * @param int|float|string $minValue
67 public function setMinValue($minValue)
69 $this->minValue
= $minValue;
74 * Get minimum boundary for comparison
76 * @return null|int|float|string
78 public function getMinValue()
80 return $this->minValue
;
84 * Set maximum boundary for comparison
86 * @param int|float|string $maxValue
89 public function setMaxValue($maxValue)
91 $this->maxValue
= $maxValue;
96 * Get maximum boundary for comparison
98 * @return null|int|float|string
100 public function getMaxValue()
102 return $this->maxValue
;
106 * Set specification string to use in forming SQL predicate
108 * @param string $specification
111 public function setSpecification($specification)
113 $this->specification
= $specification;
118 * Get specification string to use in forming SQL predicate
122 public function getSpecification()
124 return $this->specification
;
128 * Return "where" parts
132 public function getExpressionData()
136 $this->getSpecification(),
137 array($this->identifier
, $this->minValue
, $this->maxValue
),
138 array(self
::TYPE_IDENTIFIER
, self
::TYPE_VALUE
, self
::TYPE_VALUE
),