Error Info: Array ( [0] => HY000 [1] => 2002 [2] => No such file or directory )
in /home/forge/inyoursoup.com/releases/1/vendor/yiisoft/yii2/db/Connection.php at line 722
if ($enableProfiling) { Yii::endProfile($token, __METHOD__); } } catch (\PDOException $e) { if ($enableProfiling) { Yii::endProfile($token, __METHOD__); } throw new Exception($e->getMessage(), $e->errorInfo, $e->getCode(), $e); } } /** * Closes the currently active DB connection. * It does nothing if the connection is already closed. */ public function close() {
* Returns the PDO instance for the currently active master connection. * This method will open the master DB connection and then return [[pdo]]. * @return PDO the PDO instance for the currently active master connection. */ public function getMasterPdo() { $this->open(); return $this->pdo; } /** * Returns the currently active slave connection. * If this method is called for the first time, it will try to open a slave connection when [[enableSlaves]] is true.
* is available and `$fallbackToMaster` is false. */ public function getSlavePdo($fallbackToMaster = true) { $db = $this->getSlave(false); if ($db === null) { return $fallbackToMaster ? $this->getMasterPdo() : null; } return $db->pdo; } /**
if ($this->db->getTransaction()) { // master is in a transaction. use the same connection. $forRead = false; } if ($forRead || $forRead === null && $this->db->getSchema()->isReadQuery($sql)) { $pdo = $this->db->getSlavePdo(true); } else { $pdo = $this->db->getMasterPdo(); } try { $this->pdoStatement = $pdo->prepare($sql);
Yii::debug('Query result served from cache', 'yii\db\Command::query'); return $result[0]; } } } $this->prepare(true); try { $profile and Yii::beginProfile($rawSql, 'yii\db\Command::query'); $this->internalExecute($rawSql);
* @return array all rows of the query result. Each array element is an array representing a row of data. * An empty array is returned if the query results in nothing. * @throws Exception execution failed */ public function queryAll($fetchMode = null) { return $this->queryInternal('fetchAll', $fetchMode); } /** * Executes the SQL statement and returns the first row of the result. * This method is best used when only the first row of result is needed for a query. * @param int|null $fetchMode the result fetch mode. Please refer to [PHP manual](https://www.php.net/manual/en/pdostatement.setfetchmode.php)
* @throws \Exception if DB query fails */ protected function findColumns($table) { $sql = 'SHOW FULL COLUMNS FROM ' . $this->quoteTableName($table->fullName); try { $columns = $this->db->createCommand($sql)->queryAll(); } catch (\Exception $e) { $previous = $e->getPrevious(); if ($previous instanceof \PDOException && strpos($previous->getMessage(), 'SQLSTATE[42S02') !== false) { // table does not exist // https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html#error_er_bad_table_error return false;
*/ protected function loadTableSchema($name) { $table = new TableSchema(); $this->resolveTableNames($table, $name); if ($this->findColumns($table)) { $this->findConstraints($table); return $table; } return null; }
} $rawName = $this->getRawTableName($name); if (!isset($this->_tableMetadata[$rawName])) { $this->loadTableMetadataFromCache($cache, $rawName); } if ($refresh || !array_key_exists($type, $this->_tableMetadata[$rawName])) { $this->_tableMetadata[$rawName][$type] = $this->{'loadTable' . ucfirst($type)}($rawName); $this->saveTableMetadataToCache($cache, $rawName); } return $this->_tableMetadata[$rawName][$type]; }
* @param string $name table name. The table name may contain schema name if any. Do not quote the table name. * @param bool $refresh whether to reload the table schema even if it is found in the cache. * @return TableSchema|null table metadata. `null` if the named table does not exist. */ public function getTableSchema($name, $refresh = false) { return $this->getTableMetadata($name, 'schema', $refresh); } /** * Returns the metadata for all tables in the database. * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema name. * @param bool $refresh whether to fetch the latest available table schemas. If this is `false`,
* @throws InvalidConfigException if the table for the AR class does not exist. */ public static function getTableSchema() { $tableSchema = static::getDb() ->getSchema() ->getTableSchema(static::tableName()); if ($tableSchema === null) { throw new InvalidConfigException('The table does not exist: ' . static::tableName()); } return $tableSchema;
protected static function filterValidColumnNames($db, array $aliases) { $columnNames = []; $tableName = static::tableName(); $quotedTableName = $db->quoteTableName($tableName); foreach (static::getTableSchema()->getColumnNames() as $columnName) { $columnNames[] = $columnName; $columnNames[] = $db->quoteColumnName($columnName); $columnNames[] = "$tableName.$columnName"; $columnNames[] = $db->quoteSql("$quotedTableName.[[$columnName]]"); foreach ($aliases as $tableAlias) { $columnNames[] = "$tableAlias.$columnName";
* @internal */ protected static function filterCondition(array $condition, array $aliases = []) { $result = []; $db = static::getDb(); $columnNames = static::filterValidColumnNames($db, $aliases); foreach ($condition as $key => $value) { if (is_string($key) && !in_array($db->quoteSql($key), $columnNames, true)) { throw new InvalidArgumentException('Key "' . $key . '" is not a column name and can not be used as a filter'); } $result[$key] = is_array($value) ? array_values($value) : $value;
$condition = [$pk => is_array($condition) ? array_values($condition) : $condition]; } else { throw new InvalidConfigException('"' . get_called_class() . '" must have a primary key.'); } } elseif (is_array($condition)) { $aliases = static::filterValidAliases($query); $condition = static::filterCondition($condition, $aliases); } return $query->andWhere($condition); } /**
/** * {@inheritdoc} * @return static|null ActiveRecord instance matching the condition, or `null` if nothing matches. */ public static function findOne($condition) { return static::findByCondition($condition)->one(); } /** * {@inheritdoc} * @return static[] an array of ActiveRecord instances, or an empty array if nothing matches. */
{ if ($id === null && $slug === null) { $product = $this; } elseif ($id !== null && $slug === null) { $product = $this->findOne($id); } elseif ($slug !== null) { $product = $this->findOne(['slug' => $slug]); } // ensure there is a product record if (!empty($product)) { if ($product->checkDisplayValidity()) { return $product;
* @param null $slug * @return Product|null * @throws NotFoundHttpException */ public function loadModel($id = null, $slug = null) { if (($model = (new Product())->getValidProduct($id, $slug)) !== null) { return $model; } throw new NotFoundHttpException('The requested page does not exist.'); } }
*/ public function actionSlug($categorySlug, $productSlug) { $session = Yii::$app->session; /** @var Product $product */ $product = $this->loadModel(null, $productSlug); $default_variant = $product->defaultVariant; // get this product's default variant // Ensure the product has a default variant if (empty($default_variant)) { throw new NotFoundHttpException('The requested page does not exist.');
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; $config = require __DIR__ . '/../config/web.php'; (new yii\web\Application($config))->run();
$_GET = [ 'categorySlug' => 'art-design', 'productSlug' => 'scarlet-ibis-birthday-card', ];