21 private $connection =
null;
35 private $resourceModel;
42 private $connectionName;
55 $this->connectionName = $connectionName;
66 if ($connectionName !==
null) {
68 return $this->resourceModel->getConnectionByName($connectionName);
69 }
catch (\DomainException $exception) {
73 return $this->getDefaultConnection();
81 private function getDefaultConnection()
83 if (
null === $this->connection) {
84 $this->connection = $this->resourceModel->getConnection($this->connectionName);
86 return $this->connection;
110 return $this->resourceModel->getTablePlaceholder(
$tableName);
122 $cacheKey = $this->_getTableCacheName(
$tableName);
123 if (!isset($this->tables[$cacheKey])) {
124 $this->tables[$cacheKey] = $this->resourceModel->getTableName(
$tableName, $connectionName);
126 return $this->tables[$cacheKey];
135 private function _getTableCacheName(
$tableName)
__construct(\Magento\Framework\App\ResourceConnection $resource, $connectionName=ModuleDataSetupInterface::DEFAULT_SETUP_CONNECTION)
const DEFAULT_SETUP_CONNECTION
tableExists($table, $connectionName=ResourceConnection::DEFAULT_CONNECTION)
getConnection($connectionName=null)
getTablePlaceholder($tableName)
setTable($tableName, $realTableName)
getTable($tableName, $connectionName=ResourceConnection::DEFAULT_CONNECTION)