$user->id, 'id_producer' => $producer->id ]); } public function getBy($idUser, $active = 1, $bookmark = 1) { return UserProducer::find() ->with(['producer']) ->where([ 'id_user' => $idUser, 'active' => $active, 'bookmark' => $bookmark ]) ->all(); } }