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

Commit

Permalink
Merge branch 'samsonasik-count-op'
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed May 29, 2018
2 parents adfe190 + 7736d5b commit 58271ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/Sql/Predicate/In.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ public function getExpressionData()
$replacements = [];

if (is_array($identifier)) {
$identifierSpecFragment = '(' . implode(', ', array_fill(0, count($identifier), '%s')) . ')';
$types = array_fill(0, count($identifier), self::TYPE_IDENTIFIER);
$countIdentifier = count($identifier);
$identifierSpecFragment = '(' . implode(', ', array_fill(0, $countIdentifier, '%s')) . ')';
$types = array_fill(0, $countIdentifier, self::TYPE_IDENTIFIER);
$replacements = $identifier;
} else {
$identifierSpecFragment = '%s';
Expand All @@ -122,7 +123,8 @@ public function getExpressionData()
foreach ($values as $argument) {
list($replacements[], $types[]) = $this->normalizeArgument($argument, self::TYPE_VALUE);
}
$valuePlaceholders = count($values) > 0 ? array_fill(0, count($values), '%s') : [];
$countValues = count($values);
$valuePlaceholders = $countValues > 0 ? array_fill(0, $countValues, '%s') : [];
$specification = vsprintf(
$this->specification,
[$identifierSpecFragment, '(' . implode(', ', $valuePlaceholders) . ')']
Expand Down
6 changes: 3 additions & 3 deletions src/TableGateway/Feature/MetadataFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public function postInitialize()
throw new Exception\RuntimeException('A primary key for this column could not be found in the metadata.');
}

if (count($pkc->getColumns()) == 1) {
$pkck = $pkc->getColumns();
$pkck = $pkck->getColumns();
if (count($pkc) === 1) {
$primaryKey = $pkck[0];
} else {
$primaryKey = $pkc->getColumns();
$primaryKey = $pkc;
}

$this->sharedData['metadata']['primaryKey'] = $primaryKey;
Expand Down

0 comments on commit 58271ef

Please sign in to comment.