Skip to content

Commit b970458

Browse files
author
Christian
committed
Readme
1 parent d5e923b commit b970458

1 file changed

Lines changed: 51 additions & 3 deletions

File tree

README.md

100755100644
Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Now you can create your own function using query builder easily.
3232
``` php
3333
public function method()
3434
{
35-
return $this->query()->get();
35+
return $this->query()
36+
->get();
3637
}
3738
```
3839

@@ -51,12 +52,59 @@ public class Criteria implements CriteriaInterface
5152
}
5253
```
5354

54-
Then use your criteria.
55+
#### Use your criteria
5556

5657
``` php
5758
public function method()
5859
{
59-
return $this->pushCriteria(new Criteria)->query()->get();
60+
return $this->pushCriteria(new FooCriteria)
61+
->query()
62+
->get();
63+
}
64+
```
65+
66+
#### List applied criterias
67+
68+
``` php
69+
public function method()
70+
{
71+
return $this->getCriterias();
72+
}
73+
```
74+
75+
#### Remove an applied criteria
76+
77+
``` php
78+
public function method()
79+
{
80+
return $this->pushCriteria(new FooCriteria)
81+
->popCriteria(new FooCriteria)
82+
->query()
83+
->get();
84+
}
85+
```
86+
87+
#### Remove all applied criterias
88+
89+
``` php
90+
public function method()
91+
{
92+
return $this->pushCriteria(new FooCriteria)
93+
->pushCriteria(new BarCriteria)
94+
->resetCriteria()
95+
->query()
96+
->get();
97+
}
98+
```
99+
100+
#### Global criterias for all methods in repository
101+
102+
It is possible to apply a criteria to all methods using the construct method of the repository.
103+
104+
``` php
105+
public function __construct()
106+
{
107+
$this->pushCriteria(new FooCriteria);
60108
}
61109
```
62110

0 commit comments

Comments
 (0)