in /home/congnghesx/domains/congnghe-sx.com/public_html/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 the `$schemaCache` is an instance of `DbCache` we don't use it to avoid a loop if ($this->db->enableSchemaCache && $schemaCache instanceof CacheInterface && !($schemaCache instanceof DbCache)) { $cache = $schemaCache; } $version = $cache ? $cache->get($key) : null; if (!$version) { $version = $this->db->getSlavePdo(true)->getAttribute(\PDO::ATTR_SERVER_VERSION); if ($cache) { $cache->set($key, $version, $this->db->schemaCacheDuration); } } return version_compare($version, '5.6.4', '>=');
$map = [ Schema::TYPE_DATETIME => 'datetime', Schema::TYPE_TIMESTAMP => 'timestamp', Schema::TYPE_TIME => 'time', ]; if ($this->supportsFractionalSeconds()) { $map = [ Schema::TYPE_DATETIME => 'datetime(0)', Schema::TYPE_TIMESTAMP => 'timestamp(0)', Schema::TYPE_TIME => 'time(0)', ]; }
* {@inheritdoc} */ public function init() { parent::init(); $this->typeMap = array_merge($this->typeMap, $this->defaultTimeTypeMap()); } /** * {@inheritdoc} */ protected function defaultExpressionBuilders()
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
* @param Connection $connection the database connection. * @param array $config name-value pairs that will be used to initialize the object properties */ public function __construct($connection, $config = []) { $this->db = $connection; parent::__construct($config); } /** * {@inheritdoc} */ public function init()
$dependencies = $this->resolveDependencies($dependencies, $reflection); if (!$reflection->isInstantiable()) { throw new NotInstantiableException($reflection->name); } if (empty($config)) { return $reflection->newInstanceArgs($dependencies); } $config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten)
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
* @throws InvalidConfigException if the configuration is invalid. * @see \yii\di\Container */ public static function createObject($type, array $params = []) { if (is_string($type)) { return static::$container->get($type, $params); } if (is_callable($type, true)) { return static::$container->invoke($type, $params); }
/** * Creates a query builder for the MySQL database. * @return QueryBuilder query builder instance */ public function createQueryBuilder() { return Yii::createObject(QueryBuilder::className(), [$this->db]); } /** * Resolves the table name and schema name (if any). * @param TableSchema $table the table metadata object * @param string $name the table name
/** * @return QueryBuilder the query builder for this connection. */ public function getQueryBuilder() { if ($this->_builder === null) { $this->_builder = $this->createQueryBuilder(); } return $this->_builder; } /**
/** * Returns the query builder for the current DB connection. * @return QueryBuilder the query builder for the current DB connection. */ public function getQueryBuilder() { return $this->getSchema()->getQueryBuilder(); } /** * Can be used to set [[QueryBuilder]] configuration via Connection configuration array. * * @param array $value the [[QueryBuilder]] properties to be configured.
$modelClass = $this->modelClass; if ($db === null) { $db = $modelClass::getDb(); } if ($this->sql === null) { list($sql, $params) = $db->getQueryBuilder()->build($this); } else { $sql = $this->sql; $params = $this->params; } $command = $db->createCommand($sql, $params);
if (strpos($this->indexBy, '.') === false && count($tables = $this->getTablesUsedInFrom()) > 0) { $this->select[] = key($tables) . '.' . $this->indexBy; } else { $this->select[] = $this->indexBy; } } $rows = $this->createCommand($db)->queryAll(); $results = []; $column = null; if (is_string($this->indexBy)) { if (($dotPos = strpos($this->indexBy, '.')) === false) { $column = $this->indexBy; } else {
->indexBy('id'); if ($active === true) { $query->active(); } return $query->column(); } /** * @inheritdoc * @return LangQuery the active query used by this AR class. */
{ return [ [ // ContentNegotiator will be determined from a URL or browser language settings and install it in // Yii::$app->language, which uses the class TranslatedBehavior as language translation 'class' => 'yii\filters\ContentNegotiator', 'languages' => Lang::getLocaleList() ], ]; } public function actionListall($slug) {
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component. */ public function ensureBehaviors() { if ($this->_behaviors === null) { $this->_behaviors = []; foreach ($this->behaviors() as $name => $behavior) { $this->attachBehaviorInternal($name, $behavior); } } } /**
* * @param string $name the event name * @param Event|null $event the event instance. If not set, a default [[Event]] object will be created. */ public function trigger($name, Event $event = null) { $this->ensureBehaviors(); $eventHandlers = []; foreach ($this->_eventWildcards as $wildcard => $handlers) { if (StringHelper::matchWildcard($wildcard, $name)) { $eventHandlers[] = $handlers; }
* @param Action $action the action to be executed. * @return bool whether the action should continue to run. */ public function beforeAction($action) { $event = new ActionEvent($action); $this->trigger(self::EVENT_BEFORE_ACTION, $event); return $event->isValid; } /** * This method is invoked right after an action is executed. *
/** * {@inheritdoc} */ public function beforeAction($action) { if (parent::beforeAction($action)) { if ($this->enableCsrfValidation && Yii::$app->getErrorHandler()->exception === null && !$this->request->validateCsrfToken()) { throw new BadRequestHttpException(Yii::t('yii', 'Unable to verify your data submission.')); } return true; }
break; } } $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules
$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();
// $event->sender->response->on(yii\web\Response::EVENT_AFTER_SEND, function($e){ // ob_end_flush(); // }); // }); // $application->run(); (new yii\web\Application($config))->run();
$_GET = [ '_lang' => 'en', 'slug' => 'listproduct', 'page' => '4', ];