Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How to correctly write conditions for the ExistValidator filter in YII2?
There is a validation rule.
[['content_id'], 'exist',
'skipOnError' => true,
'targetClass' => News::className(),
'targetAttribute' => 'id',
'filter' => [
'is_active' => true,
'allow_comments' => true,
// интересует это место:
['>=', 'created_at', new Expression('NOW() - INTERVAL 7 DAY')],
],
'message' => 'Новость не найдена',
'on' => [self::SCENARIO_DEFAULT, self::SCENARIO_SEND_COMMENT],
],
PHP Warning 'yii\base\ErrorException' with message 'strtoupper() expects parameter 1 to be string, array given'
).
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question