浏览代码

Add table alias to the custom finder `bitmasked` and update to use getters in others

add `$this->getTable()->getAlias()` to function findBitmasked

change  `$this->_table()->alias()` to `$this->getTable()->getAlias()` since alias() is deprecated and better to use getter for table
Sam DeVore 7 年之前
父节点
当前提交
fed155a9fc
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/Model/Behavior/BitmaskedBehavior.php

+ 4 - 4
src/Model/Behavior/BitmaskedBehavior.php

@@ -61,7 +61,7 @@ class BitmaskedBehavior extends Behavior {
 
 		$bits = $this->encodeBitmask($options['bits']);
 
-		return $query->where([$this->_config['field'] => $bits]);
+		return $query->where([$this->getTable()->getAlias() . '.' . $this->_config['field'] => $bits]);
 	}
 
 	/**
@@ -316,7 +316,7 @@ class BitmaskedBehavior extends Behavior {
 		$bitmask = $this->encodeBitmask($bits);
 
 		$field = $this->_config['field'];
-		return [$this->_table->alias() . '.' . $field => $bitmask];
+		return [$this->getTable()->getAlias() . '.' . $field => $bitmask];
 	}
 
 	/**
@@ -360,10 +360,10 @@ class BitmaskedBehavior extends Behavior {
 		$connection = $this->_table->connection();
 		$config = $connection->config();
 		if ((strpos($config['driver'], 'Postgres') !== false)) {
-			return ['("' . $this->_table->alias() . '"."' . $field . '"' . $contain . ')'];
+			return ['("' . $this->getTable->getAlias() . '"."' . $field . '"' . $contain . ')'];
 		}
 
-		return ['(' . $this->_table->alias() . '.' . $field . $contain . ')'];
+		return ['(' . $this->getTable->getAlias() . '.' . $field . $contain . ')'];
 	}
 
 }