本文整理汇总了PHP中yii\db\Query::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::all方法的具体用法?PHP Query::all怎么用?PHP Query::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\Query
的用法示例。
在下文中一共展示了Query::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUsersModulesList
public static function getUsersModulesList()
{
$query = new Query();
$query->select('modules.*,users_modules.user_id as active')->from('modules')->join('left join', 'users_modules', 'modules.id = users_modules.module_id and
users_modules.user_id= ' . Yii::$app->user->id)->orderBy('modules.id');
return $query->all();
}
示例2: getPostByTags
public static function getPostByTags()
{
$query = new Query();
$query->from('tags')->join('JOIN', 'posts_tags', 'posts_tags.tag_id = tags.id')->join('JOIN', 'posts', 'posts_tags.post_id = posts.id')->where(['tags.name' => $_GET['tags']]);
$rows = $query->all();
return $rows;
}
示例3: getAvailability
/**
* Returns calculated availability
*/
public function getAvailability()
{
$query = new Query();
$query->select('Product, Warehouse, Availability')->from('GetProductAvailability')->where("Product = {$this->ID}");
$availability = $query->all();
return $availability;
}
示例4: getUsers
/**
* Функция пополучения списка приглашенных пользователей
*/
public function getUsers()
{
$query = new Query();
$query->select('email')->from('users')->where('leader_id = :id', array(':id' => Yii::$app->user->getId()));
$rows = $query->all();
return $rows;
}
示例5: getAllMatieres
public function getAllMatieres()
{
$query_mat = new Query();
$query_mat->select('id,nom,nb_tours_complete, color, color_hl, color_rgb')->from('matiere')->orderBy('id');
$matieres = $query_mat->all();
return $this->arrayToMatiereList($matieres);
}
示例6: getArticleCategories
public static function getArticleCategories($articleId)
{
$query = new Query();
$query->select('article_categories.*,article_categories_bind.article_id as active')->from('article_categories')->join('left outer join', 'article_categories_bind', 'article_categories.id = article_categories_bind.categories and
article_categories_bind.article_id= ' . $articleId)->orderBy('article_categories.id');
return $query->all();
}
示例7: getIdByNumTitre
public function getIdByNumTitre($num, $titre)
{
$query = new Query();
$query->select('id')->from('annales_track')->where('num = ' . $num . ' AND titre LIKE "' . $titre . '"');
$data = $query->all();
return $data[0]['id'];
}
示例8: actionIndex
public function actionIndex()
{
$query = new Query();
$query->select('*')->from('auth_item')->leftJoin('auth_item_child', 'auth_item.name=auth_item_child.child')->where(['auth_item.type' => 1]);
$models = $query->all();
return $this->render('index', ['models' => $models]);
}
示例9: up
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
$this->createTable(Thumbnail::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'img_id' => 'INT UNSIGNED NOT NULL', 'thumb_path' => 'VARCHAR(255) NOT NULL', 'size_id' => 'INT UNSIGNED NOT NULL'], $tableOptions);
$this->createTable(ThumbnailSize::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'width' => 'INT UNSIGNED NOT NULL', 'height' => 'INT UNSIGNED NOT NULL', 'default_watermark_id' => 'INT UNSIGNED NULL', 'resize_mode' => 'ENUM(\'' . ManipulatorInterface::THUMBNAIL_INSET . '\',\'' . ManipulatorInterface::THUMBNAIL_OUTBOUND . '\') DEFAULT \'' . ManipulatorInterface::THUMBNAIL_INSET . '\''], $tableOptions);
$this->createTable(Watermark::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'watermark_path' => 'VARCHAR(255) NOT NULL', 'position' => 'enum(\'TOP LEFT\',\'TOP RIGHT\',\'BOTTOM LEFT\',\'BOTTOM RIGHT\',\'CENTER\') NOT NULL DEFAULT \'TOP LEFT\''], $tableOptions);
$this->createTable(ThumbnailWatermark::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'thumb_id' => 'INT UNSIGNED NOT NULL', 'water_id' => 'INT UNSIGNED NOT NULL', 'compiled_src' => 'VARCHAR(255) NOT NULL'], $tableOptions);
$defaultSize = new ThumbnailSize();
$defaultSize->setAttributes(['width' => 80, 'height' => 80]);
$defaultSize->save();
$query = new Query();
$query->select('*')->from('image');
$images = $query->all();
foreach ($images as $image) {
try {
if (file_exists(Yii::getAlias("@webroot{$image['image_src']}")) === true) {
$stream = fopen(Yii::getAlias("@webroot{$image['image_src']}"), 'r+');
Yii::$app->getModule('image')->fsComponent->putStream($image['filename'], $stream);
} else {
$this->delete(Image::tableName(), ['id' => $image['id']]);
}
} catch (\Exception $e) {
echo sprintf('[%s] %s || %s' . PHP_EOL, $e->getMessage(), $image['image_src'], $image['filename']);
}
}
$this->dropColumn(Image::tableName(), 'thumbnail_src');
$this->dropColumn(Image::tableName(), 'image_src');
$this->insert(BackendMenu::tableName(), ['parent_id' => 1, 'name' => 'Images', 'icon' => 'picture-o', 'sort_order' => 10, 'route' => '', 'added_by_ext' => 'core', 'rbac_check' => 'content manage', 'translation_category' => 'app']);
$image_menu_id = Yii::$app->db->lastInsertID;
$this->batchInsert(BackendMenu::tableName(), ['parent_id', 'name', 'route', 'added_by_ext', 'rbac_check', 'translation_category'], [[$image_menu_id, 'Thumbnails sizes', 'image/backend-thumbnail-size/index', 'core', 'content manage', 'app'], [$image_menu_id, 'Create thumbnails', 'image/backend-thumbnail/index', 'core', 'content manage', 'app'], [$image_menu_id, 'Watermarks', 'image/backend-watermark/index', 'core', 'content manage', 'app'], [$image_menu_id, 'Broken images', 'image/backend-error-images/index', 'core', 'content manage', 'app']]);
$this->createTable(ErrorImage::tableName(), ['id' => 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT', 'img_id' => 'INT UNSIGNED NOT NULL', 'class_name' => 'VARCHAR(255) NOT NULL'], $tableOptions);
$this->insert(Task::tableName(), ['action' => 'images/check-broken', 'type' => Task::TYPE_REPEAT, 'initiator' => 1, 'name' => 'Check broken images', 'cron_expression' => '* */1 * * *']);
$this->insert(Configurable::tableName(), ['module' => 'image', 'sort_order' => 8, 'section_name' => 'Images']);
}
示例10: getCustomFieldsArray
public static function getCustomFieldsArray($tour_id)
{
$query = new Query();
$query->from(CustomFields::tableName())->where([CustomFields::FIELD_TOUR_ID => $tour_id]);
$result = $query->all();
return $result;
}
示例11: GetPagesList
/**
* Получает список страниц для всплывающего окна
* @return type
*/
public function GetPagesList()
{
$query = new Query();
$query->select(['p.name', 'm.name as module'])->join("LEFT JOIN", "module as m", "m.id = p.module")->from("backend__pages as p")->where(["p.visible" => 1, "p.active" => 1]);
$result = $query->all();
return $result;
}
示例12: actionPermissions
public function actionPermissions($name)
{
$role = $this->auth->getRoles();
$roles = array_keys($role);
$query = new Query();
$query->select('*')->from('auth_item')->leftJoin('auth_item_child', ['and', 'auth_item.name=auth_item_child.child', 'auth_item_child.parent not in (\'' . implode("','", $roles) . '\')'])->where(['auth_item.type' => 2])->andWhere(['not like', 'name', '/']);
$models = $query->all();
$targetHasModels = $this->auth->getPermissionsByRole($name);
$targetHasModels = array_keys($targetHasModels);
//取用户所有权限的集合
$hasModel = [];
foreach ($roles as $rkey => $subRole) {
$subPermission = $this->auth->getPermissionsByRole($subRole);
$hasModel = array_merge($hasModel, $subPermission);
}
$hasModels = array_keys($hasModel);
$hasModelsTree = [];
foreach ($models as $key => $model) {
if (in_array($model['name'], $hasModels)) {
array_push($hasModelsTree, $model);
} else {
$subModels = $this->getSubModels($model, $models);
foreach ($subModels as $subKey => $subModel) {
if (in_array($subModel['name'], $hasModels)) {
array_push($hasModelsTree, $model);
}
}
}
}
return $this->render('permissions', ['models' => $hasModelsTree, 'hasModels' => $targetHasModels]);
}
示例13: init
public function init()
{
parent::init();
if ($this->page == 'index') {
if ($this->cat == 'all' or $this->cat == null) {
$query = Logotypes::find()->limit(15);
} else {
$query_cat = new Query();
$query_cat->select('id')->from('category')->where(['name' => $this->cat]);
$cat_id = $query_cat->all()[0]['id'];
$query = Logotypes::find()->limit(15)->where(['category' => $cat_id]);
}
$logos = $query->all();
shuffle($logos);
} else {
if ($this->cat == 'all' or $this->cat == null) {
$query = Logotypes::find();
} else {
$query_cat = new Query();
$query_cat->select('id')->from('category')->where(['name' => $this->cat]);
$cat_id = $query_cat->all()[0]['id'];
$query = Logotypes::find()->where(['category' => $cat_id]);
}
$countQuery = clone $query;
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 15]);
$logos = $query->offset($pages->offset)->limit($pages->limit)->all();
$this->pages = $pages;
}
$this->logos = $logos;
}
示例14: getPsychologistProblemsList
public function getPsychologistProblemsList($psychologistId)
{
$query = new Query();
$query->select('problems.*')->from('problems')->join('left outer join', 'psychologist_problems', 'problems.id = psychologist_problems.problem_id and
psychologist_problems.psychologist_id= ' . $psychologistId)->orderBy('problems.id');
return $query->all();
}
示例15: actionIndex
public function actionIndex($date = null)
{
// $apteki=LogReestr::find()->where(['resstr' => 'apteki'])->all();
if (!$date) {
$date = date('Y-m');
}
$db = new Query();
$db->from(LogReestr::tableName());
$db->select(['log_reestr.created_at', 'log_reestr.address', 'log_reestr.resstr', 'log_reestr.id_resstr', 'log_reestr.action', 'log_reestr.name', 'log_reestr.ur_l_id', 'log_reestr.id_resstr', 'log_reestr.change', 'users.username', 'log_reestr.id_resstr']);
$db->where(['=', 'resstr', 'apteki']);
$db->leftJoin('users', "users.id = log_reestr.user");
$db->orderBy('log_reestr.created_at DESC');
$date_search = $date . '%';
$db->andWhere(['like', 'log_reestr.created_at', $date_search, false]);
$apteki = $db->all();
// $apteki_count = $db->count();
$db = new Query();
$db->from(LogReestr::tableName());
$db->select(['log_reestr.created_at', 'log_reestr.address', 'log_reestr.resstr', 'log_reestr.id_resstr', 'log_reestr.name', 'log_reestr.action', 'log_reestr.change', 'users.username', 'log_reestr.id_resstr']);
$db->where(['=', 'resstr', 'ur_l']);
$db->leftJoin('users', "users.id = log_reestr.user");
$db->andWhere(['like', 'log_reestr.created_at', $date_search, false]);
$db->orderBy('log_reestr.created_at DESC');
$ur_l = $db->all();
// $ur_l_count = $db->count();
$statm = \Yii::$app->db->createCommand("SELECT users.username , COUNT(*) as count FROM log_reestr INNER JOIN users ON users.id=log_reestr.user\n where log_reestr.created_at like '" . $date . "%'\n GROUP BY USER order by count DESC");
$stat = $statm->queryAll();
$statAllm = \Yii::$app->db->createCommand("SELECT COUNT(*) as count FROM log_reestr\n where log_reestr.created_at like '" . $date . "%' ");
$statAll = $statAllm->queryOne();
return $this->render('index', ['apteki' => $apteki, 'ur_l' => $ur_l, 'date' => $date, 'stat' => $stat, 'statAll' => $statAll]);
}