Answer the question
In order to leave comments, you need to log in
Get value passed to yii2 model?
Good evening.
There is a form in which I enter id, this field in the model is called subscription:
How to get this id in behaviors?
public function behaviors()
{
return [
[
'class' => AttributeBehavior::class,
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => [
'count',
]
],
'value' => Subscription::findOne(вот тут)->count,
],
];
}
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