2
2
3
3
# Shared Query Builder
4
4
5
- #### Doctrine 2 [ Query Builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/query-builder.html ) decorator - [ AndanteProject] ( https://github.com/andanteproject )
5
+ #### Doctrine 2/3 [ Query Builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/query-builder.html ) decorator - [ AndanteProject] ( https://github.com/andanteproject )
6
6
7
7
[ ![ Latest Version] ( https://img.shields.io/github/release/andanteproject/shared-query-builder.svg )] ( https://github.com/andanteproject/shared-query-builder/releases )
8
8
![ Github actions] ( https://github.com/andanteproject/shared-query-builder/actions/workflows/workflow.yml/badge.svg?branch=main )
9
9
![ Php8] ( https://img.shields.io/badge/PHP-%208.x-informational?style=flat&logo=php )
10
10
![ PhpStan] ( https://img.shields.io/badge/PHPStan-Level%208-syccess?style=flat&logo=php )
11
11
12
- A Doctrine 2 [ Query Builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8 /reference/query-builder.html )
12
+ A Doctrine 2 [ Query Builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/3.2 /reference/query-builder.html )
13
13
decorator that makes easier to build your query in shared contexts.
14
14
15
15
## Why do I need this?
@@ -20,13 +20,13 @@ places/classes.
20
20
Without ` SharedQueryBuilder ` there is no way to do that unless * guessing Entity aliases* and messing up with * join
21
21
statements* .
22
22
23
- This [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8 /reference/query-builder.html )
23
+ This [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/3.2 /reference/query-builder.html )
24
24
decorator addresses some problems you can find in a real world situation you usually solve with workarounds and business
25
25
conventions.
26
26
27
27
## Features
28
28
29
- - Ask [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8 /reference/query-builder.html )
29
+ - Ask [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/3.2 /reference/query-builder.html )
30
30
which alias is used for an entity when you are outside its creation context;
31
31
- ** Lazy joins** to declare join statements to be performed only if related criteria are defined;
32
32
- ** Immutable** and ** unique** query ** parameters** ;
@@ -47,7 +47,7 @@ $ composer require andanteproject/shared-query-builder
47
47
## Set up
48
48
49
49
After creating
50
- your [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8 /reference/query-builder.html ) , wrap
50
+ your [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/3.2 /reference/query-builder.html ) , wrap
51
51
it inside our ` SharedQueryBuilder ` .
52
52
53
53
``` php
@@ -62,7 +62,7 @@ $sqb = SharedQueryBuilder::wrap($qb);
62
62
```
63
63
64
64
From now on, you can use ` $sqb ` exactly as you usually do
65
- with [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/2.8 /reference/query-builder.html ) (every
65
+ with [ query builder] ( https://www.doctrine-project.org/projects/doctrine-orm/en/3.2 /reference/query-builder.html ) (every
66
66
single method of ` QueryBuilder ` is available on ` SharedQueryBuilder ` ), ** but with some useful extra methods** 🤫.
67
67
68
68
When you're done building your query, just ** unwrap** your ` SharedQueryBuilder ` .
@@ -161,7 +161,7 @@ or [some examples](#examples) to achieve your "OMG" revelation moment.
161
161
Let's suppose we need to list ` User ` entities but we also have an ** optional filter** to search an user by it's
162
162
address ` Building ` name.
163
163
164
- There is no need to perform any join until we decide to use that filter. We can use ** Laxy Join** to achieve this.
164
+ There is no need to perform any join until we decide to use that filter. We can use ** Lazy Join** to achieve this.
165
165
166
166
``` php
167
167
$sqb = SharedQueryBuilder::wrap($userRepository->createQueryBuilder('u'));
0 commit comments