Answer the question
In order to leave comments, you need to log in
Is it possible to somehow check the index in relation yii2?
Hey!
I have a query that has links: ->with(['one', 'two'])
and the code for them:
public function getOne() {
return $this->hasOne(One::classname(), ['id' => 'one']);
}
public function getTwo() {
return $this->hasOne(Two::classname(), ['id' => 'two']);
}
[
0 => [
'id' => 1,
'one' => 10,
]
1 => [
'id' => 2,
'two' => 12,
]
2 => [
'id' => 3,
'two' => 25,
]
]
if(!isset($this->one))
return false;
return $this->hasOne(One::classname(), ['id' => 'one']);
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