PHPackages                             gyro/query-table-gateway - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. gyro/query-table-gateway

ActiveLibrary[Database &amp; ORM](/categories/database)

gyro/query-table-gateway
========================

Table/Query Gateway with Doctrine DBAL mapping to objects with typed properties

200PHPCI failing

Since Nov 17Pushed 6y ago4 watchersCompare

[ Source](https://github.com/gyro-project/query-table-gateway)[ Packagist](https://packagist.org/packages/gyro/query-table-gateway)[ RSS](/packages/gyro-query-table-gateway/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Table/Query Gateway with Doctrine DBAL
======================================

[](#tablequery-gateway-with-doctrine-dbal)

This is a very simple Table/Query Gateway library on top of [Doctrine DBAL](https://github.com/doctrine/dbal) (with some ORM mapping support). It requires PHP 7.4's property types for automatic mapping between SQL queries and objects.

The idea is to assemble SQL Query, information about the columns/types from the queries metadata and a fully typed target class into an easy to use object relational mapper.

Currently this library only implements read functionality, that means the direction from database to objects.

Installation
------------

[](#installation)

Via Composer:

```
composer require gyro/query-table-gateway

```

Setup in code:

```
use Doctrine\DBAL\DriverManager;
use Gyro\TableGateway\DBAL\DBALGateway;

$connection = DriverManager::getConnection($config);
$gateway = new DBALGateway($connection);
```

See API below the examples.

Example
-------

[](#example)

In this query for a list of users, its organizations are joined into the result as a group contact string, which is then mapped to an array by `explode(',', $tring)`.

```
