3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Db\RowGateway
;
12 use Zend\Db\Adapter\Adapter
;
15 class RowGateway
extends AbstractRowGateway
21 * @param string $primaryKeyColumn
22 * @param string|\Zend\Db\Sql\TableIdentifier $table
23 * @param Adapter|Sql $adapterOrSql
24 * @throws Exception\InvalidArgumentException
26 public function __construct($primaryKeyColumn, $table, $adapterOrSql = null)
29 $this->primaryKeyColumn
= (array) $primaryKeyColumn;
32 $this->table
= $table;
35 if ($adapterOrSql instanceof Sql
) {
36 $this->sql
= $adapterOrSql;
37 } elseif ($adapterOrSql instanceof Adapter
) {
38 $this->sql
= new Sql($adapterOrSql, $this->table
);
40 throw new Exception\
InvalidArgumentException('A valid Sql object was not provided.');
43 if ($this->sql
->getTable() !== $this->table
) {
44 throw new Exception\
InvalidArgumentException('The Sql object provided does not have a table that matches this row object');