|
|
@@ -60,8 +60,8 @@ class Comparison implements ExpressionInterface, FieldInterface {
|
|
|
* @param string $operator the operator used for comparing field and value
|
|
|
*/
|
|
|
public function __construct($field, $value, $type, $operator) {
|
|
|
- $this->field($field);
|
|
|
- $this->value($value);
|
|
|
+ $this->setField($field);
|
|
|
+ $this->setValue($value);
|
|
|
$this->_operator = $operator;
|
|
|
|
|
|
if (is_string($type)) {
|
|
|
@@ -74,27 +74,29 @@ class Comparison implements ExpressionInterface, FieldInterface {
|
|
|
*
|
|
|
* @param mixed $value The value to compare
|
|
|
* @return void
|
|
|
+ * @deprecated 3.0.0 Will be removed in 3.0.0 stable. Use setValue() instead.
|
|
|
*/
|
|
|
public function value($value) {
|
|
|
- $this->_value = $value;
|
|
|
+ return $this->setValue($value);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Returns the value used for comparison
|
|
|
+ * Sets the value
|
|
|
*
|
|
|
- * @return mixed
|
|
|
+ * @param mixed $value The value to compare
|
|
|
+ * @return void
|
|
|
*/
|
|
|
- public function getValue() {
|
|
|
- return $this->_value;
|
|
|
+ public function setValue($value) {
|
|
|
+ $this->_value = $value;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Returns the operator used for comparison
|
|
|
+ * Returns the value used for comparison
|
|
|
*
|
|
|
- * @return string
|
|
|
+ * @return mixed
|
|
|
*/
|
|
|
- public function getOperator() {
|
|
|
- return $this->_operator;
|
|
|
+ public function getValue() {
|
|
|
+ return $this->_value;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -108,6 +110,15 @@ class Comparison implements ExpressionInterface, FieldInterface {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Returns the operator used for comparison
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getOperator() {
|
|
|
+ return $this->_operator;
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* Convert the expression into a SQL fragment.
|
|
|
*
|
|
|
* @param \Cake\Database\ValueBinder $generator Placeholder generator object
|