Browse Source

Consolidating common code

Jose Lorenzo Rodriguez 11 years ago
parent
commit
7a45522f3f

+ 2 - 6
src/Database/Expression/BetweenExpression.php

@@ -15,6 +15,7 @@
 namespace Cake\Database\Expression;
 
 use Cake\Database\ExpressionInterface;
+use Cake\Database\Expression\FieldTrait;
 use Cake\Database\ValueBinder;
 
 /**
@@ -24,12 +25,7 @@ use Cake\Database\ValueBinder;
  */
 class BetweenExpression implements ExpressionInterface {
 
-/**
- * The first value in the expression
- *
- * @var mixed
- */
-	protected $_field;
+	use FieldTrait;
 
 /**
  * The first value in the expression

+ 2 - 25
src/Database/Expression/Comparison.php

@@ -15,6 +15,7 @@
 namespace Cake\Database\Expression;
 
 use Cake\Database\ExpressionInterface;
+use Cake\Database\Expression\FieldTrait;
 use Cake\Database\ValueBinder;
 
 /**
@@ -26,12 +27,7 @@ use Cake\Database\ValueBinder;
  */
 class Comparison implements ExpressionInterface {
 
-/**
- * The field name or expression to be used in the left hand side of the operator
- *
- * @var string
- */
-	protected $_field;
+	use FieldTrait;
 
 /**
  * The value to be used in the right hand side of the operation
@@ -73,16 +69,6 @@ class Comparison implements ExpressionInterface {
 	}
 
 /**
- * Sets the field name
- *
- * @param string $field The field to compare with.
- * @return void
- */
-	public function field($field) {
-		$this->_field = $field;
-	}
-
-/**
  * Sets the value
  *
  * @param mixed $value The value to compare
@@ -93,15 +79,6 @@ class Comparison implements ExpressionInterface {
 	}
 
 /**
- * Returns the field name
- *
- * @return string|\Cake\Database\ExpressionInterface
- */
-	public function getField() {
-		return $this->_field;
-	}
-
-/**
  * Returns the value used for comparison
  *
  * @return mixed