Zend 3/Laminas database select subqueries

I’ve been working on some refactoring of queries and got some trouble with making subqueries with TableGateway entity. Unfortunately there’s no solution for that on internets 🙁 so I had to find it by myself:

$select = new Select();
    'custom_column' => new Expression('?', [
        (new Select)
          ->...subselect query...

As you can see it simply works with named params. When select see Query as a part of expression, it casts it to string.

Click to rate this post!
[Total: 1 Average: 5]

Вам также может понравиться

About the Author: deniskoronets

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *