models/News.php:
Код: Выделить всё
<?php
namespace app\models;
use yii\db\ActiveRecord;
class News extends ActiveRecord
{
}
Код: Выделить всё
<?php
namespace app\controllers;
use yii\web\Controller;
use app\models\News;
class HomeController extends Controller
{
public function actionIndex()
{
$news = News::find();
return $this->render('index', compact('news'));
}
}
Код: Выделить всё
<?php
/** @var yii\web\View $this */
use yii\helpers\Html;
$this->title = Yii::$app->name;
?>
<?php var_dump($news); ?>
Вывод дампа:
Код: Выделить всё
object(yii\db\ActiveQuery)#78 (33) { ["_events":"yii\base\Component":private]=> array(0) { } ["_eventWildcards":"yii\base\Component":private]=> array(0) { } ["_behaviors":"yii\base\Component":private]=> array(0) { } ["select"]=> NULL ["selectOption"]=> NULL ["distinct"]=> bool(false) ["from"]=> NULL ["groupBy"]=> NULL ["join"]=> NULL ["having"]=> NULL ["union"]=> NULL ["withQueries"]=> NULL ["params"]=> array(0) { } ["queryCacheDuration"]=> NULL ["queryCacheDependency"]=> NULL ["where"]=> NULL ["limit"]=> NULL ["offset"]=> NULL ["orderBy"]=> NULL ["indexBy"]=> NULL ["emulateExecution"]=> bool(false) ["sql"]=> NULL ["on"]=> NULL ["joinWith"]=> NULL ["modelClass"]=> string(15) "app\models\News" ["with"]=> NULL ["asArray"]=> NULL ["multiple"]=> NULL ["primaryModel"]=> NULL ["link"]=> NULL ["via"]=> NULL ["inverseOf"]=> NULL ["viaMap":"yii\db\ActiveQuery":private]=> NULL } There are many variations of passages of Lorem Ipsum available.