Skip to content

Commit

Permalink
Add table alias to the custom finder bitmasked and update to use ge…
Browse files Browse the repository at this point in the history
…tters 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
  • Loading branch information
sdevore committed Mar 31, 2018
1 parent 7539e52 commit fed155a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Model/Behavior/BitmaskedBehavior.php
Expand Up @@ -61,7 +61,7 @@ public function findBitmasked(Query $query, array $options) {

$bits = $this->encodeBitmask($options['bits']);

return $query->where([$this->_config['field'] => $bits]);
return $query->where([$this->getTable()->getAlias() . '.' . $this->_config['field'] => $bits]);
}

/**
Expand Down Expand Up @@ -316,7 +316,7 @@ public function isBit($bits) {
$bitmask = $this->encodeBitmask($bits);

$field = $this->_config['field'];
return [$this->_table->alias() . '.' . $field => $bitmask];
return [$this->getTable()->getAlias() . '.' . $field => $bitmask];
}

/**
Expand Down Expand Up @@ -360,10 +360,10 @@ protected function _containsBit($bits, $contain = true) {
$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 . ')'];
}

}

0 comments on commit fed155a

Please sign in to comment.