In Kohana that was performed as $user->has('departments', array('id' => $dep->id_department))
I dont see the same in Yii2
$customer = Customer::findOne(123);
$order = new Order();
$order->save(); // now its id is - 33
$customer->link('orders', $order); // let think relation is via table
And now I want to check If my $customer HAS this object linked Order::find(33)
I found very ugly way to do this.
$customer ->getOrders()->where(['id' => 33])->exists();
Is there are shorter and pretty solutions, as its in Kohana does ?
Kohana way:
$customer ->has('orders', ['id' => 33])