stephenahiggins/doctrine-query-builder-standalone

A standalone version of the Doctrine Query Builder

1.0.0 2024-01-03 08:52 UTC

This package is auto-updated.

Last update: 2025-05-31 00:26:13 UTC


README

A standalone implementation of the Doctrine Query Builder. Removes the dependency on having a Doctrine DB connection. This is useful for building queries for other DB connections, or using PDO to execute the query. All credit goes to the original Doctrine team.

Note: This is a work in progress and is not ready for production use.

Installation

Add the repository to your project's composer.json.

composer require stephenahiggins/doctrine-query-builder-standalone:dev-main

Usage

use DoctrineQueryBuilder\Query\StandaloneQueryBuilder;

$qb = new StandaloneQueryBuilder();
$qb->select('*')
    ->from("test_table", 'tt')
    ->innerJoin('tt', "test_table2", 'tt2', "tt.id = tt2.id")
    ->leftJoin('tt', "test_table3", 'tt3', "tt.id = tt3.id")
    ->rightJoin('tt', "test_table4", 'tt4', "tt.id = tt4.id")
    ->setMaxResults(100);

$query = $qb->getSQL();

print "Query:" . $query.PHP_EOL;

Running Tests

Run make run-tests.

Support

Please open an issue. Pull requests are welcome.