/** * Constructor * * @param \Phinx\Db\Adapter\AdapterInterface $adapter The original adapter to decorate. * @param \Cake\Database\Connection $connection The connection to actually use. */ public function __construct(AdapterInterface $adapter, Connection $connection) { $this->adapter = $adapter; $this->connection = $connection; $pdo = $adapter->getConnection(); if ($pdo->getAttribute(PDO::ATTR_ERRMODE) !== PDO::ERRMODE_EXCEPTION) { $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } $connection->cacheMetadata(false); $connection->driver()->connection($pdo); }
/** * @inheritDoc */ public function cacheMetadata($cache) { $this->_schemaMethodsCollection = null; parent::cacheMetadata($cache); }
/** * Constructor * * @param \Phinx\Db\Adapter\AdapterInterface $adapter The original adapter to decorate. * @param \Cake\Database\Connection $connection The connection to actually use. */ public function __construct(AdapterInterface $adapter, Connection $connection) { $this->adapter = $adapter; $this->connection = $connection; $pdo = $adapter->getConnection(); if ($pdo->getAttribute(PDO::ATTR_ERRMODE) !== PDO::ERRMODE_EXCEPTION) { $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } $connection->cacheMetadata(false); if ($connection->driver() instanceof Postgres) { $config = $connection->config(); $schema = empty($config['schema']) ? 'public' : $config['schema']; $pdo->exec('SET search_path TO ' . $schema); } $connection->driver()->connection($pdo); }