/** * Returns table name for specified shop. * * @param int|null $shopId If null will use active shop. * * @throws InvalidArgumentException * * @return string */ public function getTableName($shopId = null) { $tableName = parent::getTableName(); if ($shopId === null) { $shopId = $this->getActiveShopId(); } if (!$this->isShopValid($shopId)) { throw new InvalidArgumentException("Shop id \"{$shopId}\" is invalid."); } $tableName .= '_' . $shopId; try { SqlValidator::validateTableName($tableName); } catch (InvalidArgumentException $e) { throw new InvalidArgumentException("Shop id \"{$shopId}\" is invalid.", 0, $e); } return $tableName; }
/** * Set table name. * * @param string $tableName */ public function setTableName($tableName) { $this->tableName = SqlValidator::validateTableName($tableName); }