Are Query Parameters Bound when Passed as Array (to where(), having(), etc)

When forming a DB query as a string to pass into a where() or similar function, parameters must be bound.

When passing an array/hash as an argument into where(), do parameters still need to be bound? This was not the case in Yii 1.x so Im assuming the same goes for Yii 2 (no need to make bind params when using an array). I was looking through the guides/docs but diddnt see any note to confirm (and just wanna be safe).

So for example, does the following query require bind params?

$post = Post::find()->published()->andWhere(


        'id'   => $id,

        'slug' => $slug



The vars $id and $slug would be derived from a URL. Since they are passed into andWhere() via a hash, they dont need to be bound, correct? Is the binding is autoperformed by the query builder at some point?

Has anyone stumbled upon where this is documented?

No, in case of hash parameters are bound automatically.