WHERE rc.constraint_schema = database() AND kcu.table_schema = database() AND rc.table_name = :tableName AND kcu.table_name = :tableName1 SQL; try { $rows = $this->db->createCommand($sql, [':tableName' => $table->name, ':tableName1' => $table->name])->queryAll(); $constraints = []; foreach ($rows as $row) { $constraints[$row['constraint_name']]['referenced_table_name'] = $row['referenced_table_name']; $constraints[$row['constraint_name']]['columns'][$row['column_name']] = $row['referenced_column_name']; } $table->foreignKeys = []; foreach ($constraints as $name => $constraint) { $table->foreignKeys[$name] = array_merge( [$constraint['referenced_table_name']], $constraint['columns'] );
try { $rows = $this->db->createCommand($sql, [':tableName' => $table->name, ':tableName1' => $table->name])->queryAll(); $constraints = []; foreach ($rows as $row) { $constraints[$row['constraint_name']]['referenced_table_name'] = $row['referenced_table_name']; $constraints[$row['constraint_name']]['columns'][$row['column_name']] = $row['referenced_column_name']; } $table->foreignKeys = []; foreach ($constraints as $name => $constraint) { $table->foreignKeys[$name] = array_merge(
protected function loadTableSchema($name) { $table = new TableSchema; $this->resolveTableNames($table, $name); if ($this->findColumns($table)) { $this->findConstraints($table); return $table; } else { return null; } }
if ($db->enableSchemaCache && !in_array($name, $db->schemaCacheExclude, true)) { /* @var $cache Cache */ $cache = is_string($db->schemaCache) ? Yii::$app->get($db->schemaCache, false) : $db->schemaCache; if ($cache instanceof Cache) { $key = $this->getCacheKey($name); if ($refresh || ($table = $cache->get($key)) === false) { $this->_tables[$name] = $table = $this->loadTableSchema($realName); if ($table !== null) { $cache->set($key, $table, $db->schemaCacheDuration, new TagDependency([ 'tags' => $this->getCacheTag(), ])); } } else {
* @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;
/** * @inheritdoc */ public static function populateRecord($record, $row) { $columns = static::getTableSchema()->columns; foreach ($row as $name => $value) { if (isset($columns[$name])) { $row[$name] = $columns[$name]->phpTypecast($value); } } parent::populateRecord($record, $row);
/* @var $class ActiveRecord */ $class = $this->modelClass; if ($this->indexBy === null) { foreach ($rows as $row) { $model = $class::instantiate($row); $modelClass = get_class($model); $modelClass::populateRecord($model, $row); $models[] = $model; } } else { foreach ($rows as $row) { $model = $class::instantiate($row); $modelClass = get_class($model);
public function populate($rows) { if (empty($rows)) { return []; } $models = $this->createModels($rows); if (!empty($this->join) && $this->indexBy === null) { $models = $this->removeDuplicatedModels($models); } if (!empty($this->with)) { $this->findWith($this->with, $models); }
* if the query results in nothing. */ public function one($db = null) { $row = parent::one($db); if ($row !== false) { $models = $this->populate([$row]); return reset($models) ?: null; } else { return null; } }
$realName = lcfirst(substr($method->getName(), 3)); if ($realName !== $name) { throw new InvalidParamException('Relation names are case sensitive. ' . get_class($model) . " has a relation named \"$realName\" instead of \"$name\"."); } } return $this->multiple ? $this->all() : $this->one(); } /** * If applicable, populate the query's primary model into the related records' inverse relationship * @param array $result the array of related records as generated by [[populate()]] * @since 2.0.9
} else { if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) { return $this->_related[$name]; } $value = parent::__get($name); if ($value instanceof ActiveQueryInterface) { return $this->_related[$name] = $value->findFor($name, $this); } else { return $value; } } }
return $this->isSystemAdmin(); } else if ($name == 'profile') { /** * Ensure there is always a related Profile Model also when it's * not really exists yet. */ $profile = parent::__get('profile'); if (!$this->isRelationPopulated('profile') || $profile === null) { $profile = new Profile(); $profile->user_id = $this->id; $this->populateRelation('profile', $profile); } return $profile;
} $name = ''; $format = Yii::$app->settings->get('displayNameFormat'); if ($this->profile !== null && $format == '{profile.firstname} {profile.lastname}') $name = $this->profile->firstname . " " . $this->profile->lastname; // Return always username as fallback if ($name == '' || $name == ' ') return $this->username;
*/ public function __get($name) { $getter = 'get' . $name; if (method_exists($this, $getter)) { // read property, e.g. getName() return $this->$getter(); } // behavior property $this->ensureBehaviors(); foreach ($this->_behaviors as $behavior) { if ($behavior->canGetProperty($name)) {
} elseif ($this->hasAttribute($name)) { return null; } else { if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) { return $this->_related[$name]; } $value = parent::__get($name); if ($value instanceof ActiveQueryInterface) { return $this->_related[$name] = $value->findFor($name, $this); } else { return $value; } }
$profile = new Profile(); $profile->user_id = $this->id; $this->populateRelation('profile', $profile); } return $profile; } return parent::__get($name); } public function scenarios() { $scenarios = parent::scenarios(); $scenarios['login'] = ['username', 'password'];
$this->imageOptions['data-toggle'] = 'tooltip'; $this->imageOptions['data-placement'] = 'top'; $this->imageOptions['data-original-title'] = Html::encode($this->user->displayName); Html::addCssClass($this->imageOptions, 'tt'); } $this->imageOptions['alt'] = Yii::t('base', 'Profile picture of {displayName}', ['displayName' => Html::encode($this->user->displayName)]); $html = Html::img($this->user->getProfileImage()->getUrl(), $this->imageOptions); if ($this->link) { $html = Html::a($html, $this->user->getUrl(), $this->linkOptions); }
ob_implicit_flush(false); try { /* @var $widget Widget */ $widget = Yii::createObject($config); $out = ''; if ($widget->beforeRun()) { $result = $widget->run(); $out = $widget->afterRun($result); } } catch (\Exception $e) { // close the output buffer opened above if it has not been closed already if (ob_get_level() > 0) { ob_end_clean();
<li> <div class="media"> <div class="pull-right memberActions"> <?= MemberActionsButton::widget(['user' => $user]); ?> </div> <?= Image::widget(['user' => $user, 'htmlOptions' => ['class' => 'pull-left']]); ?> <div class="media-body"> <h4 class="media-heading"> <a href="<?= $user->getUrl(); ?>"><?= Html::encode($user->displayName); ?></a> <?= UserGroupList::widget(['user' => $user]); ?> </h4> <h5><?= Html::encode($user->profile->title); ?></h5>
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require($_file_); return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidParamException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
}); return $this->render('members', array( 'keyword' => $keyword, 'group' => $group, 'users' => $searchResultSet->getResultInstances(), 'pagination' => $pagination )); } /** * Space Section of directory *
$args = $this->controller->bindActionParams($this, $params); Yii::trace('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::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
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__ . '/protected/humhub/config/web.php'), (is_readable(__DIR__ . '/protected/config/dynamic.php')) ? require(__DIR__ . '/protected/config/dynamic.php') : [], require(__DIR__ . '/protected/config/common.php'), require(__DIR__ . '/protected/config/web.php') ); (new humhub\components\Application($config))->run();
$_GET = [ 'r' => 'directory/directory/members', 'keyword' => ' rutas', ];