$this->select([
'*',
'date( from_unixtime( created_at ) ) created_at'
]);
return new FilmsQuery(get_called_class());
$query = new Query();
$query->andWhere(['some' => $this->some]);
// ... тут всякие другие условия
$dataProvider = new SqlDataProvider([
'totalCount' => $query->count(),
'sql' => $query->createCommand()->sql,
]);
/**
* Creates a boolean column.
* @return ColumnSchemaBuilder the column instance which can be further customized.
* @since 2.0.6
*/
public function boolean()
{
return $this->getDb()->getSchema()->createColumnSchemaBuilder(Schema::TYPE_BOOLEAN);
}
var url = $(this).attr('href');
$.pjax({url: url, container: '#content-pjax-container'})
$_SERVER["argv"][0]='Cron';
$_SERVER["argv"][1]='Cron';
50 3 * * * cd /usr/local/www/site.com/ && php ./yiic cron
class ConditionalRouting implements BootstrapInterface
{
/**
* @var array
*/
public $guestRules = [
'' => 'guest/index',
];
/**
* @var array
*/
public $userRules = [
'' => 'user/index'
];
/**
* @inheritDoc
*/
public function bootstrap($app)
{
$manager = \Yii::$app->urlManager;
$manager->addRules(\Yii::$app->user->isGuest ? $this->guestRules : $this->userRules, false);
}
}
...
'bootstrap' => [
\app\components\ConditionalRouting::class
],
...
+ * In order to catch logs written by this class, you need to setup a log route for 'yii\swiftmailer\Logger::add' category.
+ * For example:
+ *
+ * ~~~
+ * 'log' => [
+ * 'targets' => [
+ * [
+ * 'class' => 'yii\log\FileTarget',
+ * 'categories' => ['yii\swiftmailer\Logger::add'],
+ * ],
+ * ],
+ * ],
->select('article.*, DATE_FORMAT(FROM_UNIXTIME(`article.sort_date`), \'%d.%m.%Y\') as date')
->orderBy('sort_date')
<?php
class NewsProvider
{
public function getNews()
{
return News::find()->all();
}
}
class View extends yii\web\View
{
/**
* @var NewsProvider
*/
private $newsProvider;
/**
* @var array
*/
private $news;
public function __construct(NewsProvider $newsProvider, array $config = [])
{
$this->newsProvider = $newsProvider;
parent::__construct($config);
}
public function getNews()
{
if (!$this->news) {
$this->news = $this->newsProvider->getNews();
}
return $this->news;
}
}
echo NewsWidget::widget(['items' => $this->getNews()]);
// в файле config/web.php
'components' => [
'view' => 'app\components\web\View',
],
[
'<slug:[\w\/-]+>' => '/page/view',
]
'components' => [
'assetManager' => [
'converter' => [
'class' => 'yii\web\AssetConverter',
'commands' => [
'less' => false,
],
],
],
],