diff --git a/src/Metadata/Source/AbstractSource.php b/src/Metadata/Source/AbstractSource.php index 5c3c4d083e..209be55115 100644 --- a/src/Metadata/Source/AbstractSource.php +++ b/src/Metadata/Source/AbstractSource.php @@ -11,7 +11,12 @@ use Zend\Db\Adapter\Adapter; use Zend\Db\Metadata\MetadataInterface; -use Zend\Db\Metadata\Object; +use Zend\Db\Metadata\Object\TableObject; +use Zend\Db\Metadata\Object\ViewObject; +use Zend\Db\Metadata\Object\ColumnObject; +use Zend\Db\Metadata\Object\ConstraintObject; +use Zend\Db\Metadata\Object\ConstraintKeyObject; +use Zend\Db\Metadata\Object\TriggerObject; abstract class AbstractSource implements MetadataInterface { @@ -115,10 +120,10 @@ public function getTable($tableName, $schema = null) $data = $this->data['table_names'][$schema][$tableName]; switch ($data['table_type']) { case 'BASE TABLE': - $table = new Object\TableObject($tableName); + $table = new TableObject($tableName); break; case 'VIEW': - $table = new Object\ViewObject($tableName); + $table = new ViewObject($tableName); $table->setViewDefinition($data['view_definition']); $table->setCheckOption($data['check_option']); $table->setIsUpdatable($data['is_updatable']); @@ -238,7 +243,7 @@ public function getColumn($columnName, $table, $schema = null) $info = $this->data['columns'][$schema][$table][$columnName]; - $column = new Object\ColumnObject($columnName, $table, $schema); + $column = new ColumnObject($columnName, $table, $schema); $props = [ 'ordinal_position', 'column_default', 'is_nullable', 'data_type', 'character_maximum_length', 'character_octet_length', @@ -300,7 +305,7 @@ public function getConstraint($constraintName, $table, $schema = null) } $info = $this->data['constraints'][$schema][$table][$constraintName]; - $constraint = new Object\ConstraintObject($constraintName, $table, $schema); + $constraint = new ConstraintObject($constraintName, $table, $schema); foreach ([ 'constraint_type' => 'setType', @@ -345,7 +350,7 @@ public function getConstraintKeys($constraint, $table, $schema = null) $keys = []; foreach ($this->data['constraint_keys'][$schema] as $constraintKeyInfo) { if ($constraintKeyInfo['table_name'] == $table && $constraintKeyInfo['constraint_name'] === $constraint) { - $keys[] = $key = new Object\ConstraintKeyObject($constraintKeyInfo['column_name']); + $keys[] = $key = new ConstraintKeyObject($constraintKeyInfo['column_name']); $key->setOrdinalPosition($constraintKeyInfo['ordinal_position']); if (isset($references[$constraint])) { //$key->setReferencedTableSchema($constraintKeyInfo['referenced_table_schema']); @@ -408,7 +413,7 @@ public function getTrigger($triggerName, $schema = null) $info = $this->data['triggers'][$schema][$triggerName]; - $trigger = new Object\TriggerObject(); + $trigger = new TriggerObject(); $trigger->setName($triggerName); $trigger->setEventManipulation($info['event_manipulation']); diff --git a/src/Sql/AbstractSql.php b/src/Sql/AbstractSql.php index 1c5c8b6383..da3f12ef52 100644 --- a/src/Sql/AbstractSql.php +++ b/src/Sql/AbstractSql.php @@ -241,7 +241,12 @@ protected function createSqlFromSpecificationAndParameters($specifications, $par if (isset($paramSpecs[$position]['combinedby'])) { $multiParamValues = []; foreach ($paramsForPosition as $multiParamsForPosition) { - $ppCount = count($multiParamsForPosition); + if (is_array($multiParamsForPosition) || $multiParamsForPosition instanceof Countable) { + $ppCount = count($multiParamsForPosition); + } elseif (is_string($multiParamsForPosition)) { + $ppCount = 1; + } + if (!isset($paramSpecs[$position][$ppCount])) { throw new Exception\RuntimeException(sprintf( 'A number of parameters (%d) was found that is not supported by this specification',