Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Latest commit

 

History

History
62 lines (36 loc) · 1.79 KB

index.md

File metadata and controls

62 lines (36 loc) · 1.79 KB

Getting Started With GOS Query Builder

by default, Doctrine2 create new empty instance of query builder, that force you to repeat the operation in each methods. Keep your repository clean, healthy, avoid to repeat yourself, it's why this component exists.

Prerequisites

This component requires Doctrine2.1 at least.

Installation

Installation is very quick :)

  1. Download GosDoctrineQueryBuilder
  2. Configure doctrine2 (optional)

Step 1 : Download GosDoctrineQueryBuilder use composer

php composer.phar require gos/doctrine-query-builder "~1.0"

then composer update

Step 2 : Configure Doctrine2 (optional)

By default all doctrine2 repository extend of EntityRepository. This will replace this extend by GosEntityRepository wich provide loadQueryBuilder method, to retrieve your prepolated query builder. We let you free to use it, or implement your own to retrieve your QueryBuilder. See usage.md to load QueryBuilder wihout our repository.

<?php

use Doctrine\ORM\Configuration;

$config = new Configuration;
$config->setDefaultRepositoryClassName('Gos\\Component\\DoctrineQueryBuilder\\GosEntityRepository');

$em = EntityManager::create($connectionOptions, $config);

Symfony2 integration

doctrine:
    orm:
        default_repository_class: Gos\Component\DoctrineQueryBuilder\GosEntityRepository

Next step