findAll()/findOne() using different attributes

Hi guys,

a trivial question, but i just don’t know how to get it answered. Following Statement will give me back all values of Dateianhang as long there is a value for id_mail_ausgang




$files = Dateianhang::findAll(['id_e_dateianhang' => EDateianhang::findOne(['id_mail_ausgang' => $id])->id]);



What about, If I wanna get all values of [size=“2”]Dateianhang as long there is a a value for id_mail_ausgang or id_person? I try like this, but I don’t do well with it. As it seems, id_mail_ausgang and id_person are linked by AND-operator instead OR-operator[/size]

[size="2"]




$files = Dateianhang::findAll(['id_e_dateianhang' => EDateianhang::findOne(['id_mail_ausgang' => $id,'id_person=>$id])->id]);



[/size]

[size="2"]Any ideas how to implement my intention?[/size]

This is a "hash format", in which all conditions are combined using "AND".

Try an "operator format" like the following:




[

    'or',

    ['id_mail_ausgang' => $id],

    ['id_person' => $id]

]



See the API doc of yii\db\QueryInterface::where().

http://www.yiiframework.com/doc-2.0/yii-db-queryinterface.html#where()-detail

Great. Reading ur statement helped me solving my problem. Thx for this!

This thread can be closes as succesfully solved