Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/zendframework/zf2 into ho…
Browse files Browse the repository at this point in the history
…tfix/session-container-array-object
  • Loading branch information
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
40 changes: 21 additions & 19 deletions src/Adapter/DbTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
use Zend\Authentication\Result as AuthenticationResult;
use Zend\Db\Adapter\Adapter as DbAdapter;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\Sql\Expression;
use Zend\Db\Sql\Select as DbSelect;
use Zend\Db\Sql;
use Zend\Db\Sql\Expression as SqlExpr;
use Zend\Db\Sql\Predicate\Operator as SqlOp;

class DbTable extends AbstractAdapter
{
Expand All @@ -27,7 +28,7 @@ class DbTable extends AbstractAdapter
protected $zendDb = null;

/**
* @var DbSelect
* @var Sql\Select
*/
protected $dbSelect = null;

Expand Down Expand Up @@ -205,12 +206,12 @@ public function getAmbiguityIdentity()
/**
* getDbSelect() - Return the preauthentication Db Select object for userland select query modification
*
* @return DbSelect
* @return Sql\Select
*/
public function getDbSelect()
{
if ($this->dbSelect == null) {
$this->dbSelect = new DbSelect();
$this->dbSelect = new Sql\Select();
}
return $this->dbSelect;
}
Expand Down Expand Up @@ -338,19 +339,17 @@ protected function _authenticateCreateSelect()
$this->credentialTreatment = '?';
}

$credentialExpression = new Expression(
'(CASE WHEN '
. $this->zendDb->getPlatform()->quoteIdentifier($this->credentialColumn)
. ' = ' . $this->credentialTreatment
. ' THEN 1 ELSE 0 END) AS '
. $this->zendDb->getPlatform()->quoteIdentifier('zend_auth_credential_match')
$credentialExpression = new SqlExpr(
'(CASE WHEN ?' . ' = ' . $this->credentialTreatment . ' THEN 1 ELSE 0 END) AS ?',
array($this->credentialColumn, $this->credential, 'zend_auth_credential_match'),
array(SqlExpr::TYPE_IDENTIFIER, SqlExpr::TYPE_VALUE, SqlExpr::TYPE_IDENTIFIER)
);

// get select
$dbSelect = clone $this->getDbSelect();
$dbSelect->from($this->tableName)
->columns(array('*', $credentialExpression))
->where($this->zendDb->getPlatform()->quoteIdentifier($this->identityColumn) . ' = ?');
->columns(array('*', $credentialExpression))
->where(new SqlOp($this->identityColumn, '=', $this->identity));

return $dbSelect;
}
Expand All @@ -363,14 +362,17 @@ protected function _authenticateCreateSelect()
* @throws Exception\RuntimeException when an invalid select object is encountered
* @return array
*/
protected function _authenticateQuerySelect(DbSelect $dbSelect)
protected function _authenticateQuerySelect(Sql\Select $dbSelect)
{
$statement = $this->zendDb->createStatement();
$dbSelect->prepareStatement($this->zendDb, $statement);
$resultSet = new ResultSet();
$sql = new Sql\Sql($this->zendDb);
$statement = $sql->prepareStatementForSqlObject($dbSelect);
try {
$resultSet->initialize($statement->execute(array($this->credential, $this->identity)));
$resultIdentities = $resultSet->toArray();
$result = $statement->execute();
$resultIdentities = array();
// iterate result, most cross platform way
foreach ($result as $row) {
$resultIdentities[] = $row;
}
} catch (\Exception $e) {
throw new Exception\RuntimeException(
'The supplied parameters to DbTable failed to '
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
2 changes: 1 addition & 1 deletion test/Validator/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_I18n
*/
Expand Down

0 comments on commit 16438c0

Please sign in to comment.