![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/laminas/laminas-db/src/TableGateway/ |
<?php namespace Laminas\Db\TableGateway; use Laminas\Db\Adapter\AdapterInterface; use Laminas\Db\ResultSet\ResultSet; use Laminas\Db\ResultSet\ResultSetInterface; use Laminas\Db\Sql\Sql; use Laminas\Db\Sql\TableIdentifier; use function is_array; use function is_string; class TableGateway extends AbstractTableGateway { /** * Constructor * * @param string|TableIdentifier|array $table * @param Feature\AbstractFeature|Feature\FeatureSet|Feature\AbstractFeature[]|null $features * @throws Exception\InvalidArgumentException */ public function __construct( $table, AdapterInterface $adapter, $features = null, ?ResultSetInterface $resultSetPrototype = null, ?Sql $sql = null ) { // table if (! (is_string($table) || $table instanceof TableIdentifier || is_array($table))) { throw new Exception\InvalidArgumentException( 'Table name must be a string or an instance of Laminas\Db\Sql\TableIdentifier' ); } $this->table = $table; // adapter $this->adapter = $adapter; // process features if ($features !== null) { if ($features instanceof Feature\AbstractFeature) { $features = [$features]; } if (is_array($features)) { $this->featureSet = new Feature\FeatureSet($features); } elseif ($features instanceof Feature\FeatureSet) { $this->featureSet = $features; } else { throw new Exception\InvalidArgumentException( 'TableGateway expects $feature to be an instance of an AbstractFeature or a FeatureSet, or an ' . 'array of AbstractFeatures' ); } } else { $this->featureSet = new Feature\FeatureSet(); } // result prototype $this->resultSetPrototype = $resultSetPrototype ?: new ResultSet(); // Sql object (factory for select, insert, update, delete) $this->sql = $sql ?: new Sql($this->adapter, $this->table); // check sql object bound to same table if ($this->sql->getTable() !== $this->table) { throw new Exception\InvalidArgumentException( 'The table inside the provided Sql object must match the table of this TableGateway' ); } $this->initialize(); } }