File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,23 @@ Recently we added `ScrapInterface`. This interface should be implemented by mode
3131
3232## Finder
3333
34+ To set conditions, use ` where ` method:
35+
36+ ``` php
37+ $pool->find(Writer::class)
38+ ->where('`birthday` > ?', '1800-01-01')
39+ ->ids();
40+ ```
41+
42+ This method can be called multiple times, and all conditions will be joined in one block with ` AND ` operator:
43+
44+ ``` php
45+ $pool->find(Writer::class)
46+ ->where('`birthday` > ?', '1800-01-01')
47+ ->where('`birthday` < ?', '1825-01-01')
48+ ->ids();
49+ ```
50+
3451Finder can join a table, either by table name:
3552
3653``` php
Original file line number Diff line number Diff line change @@ -133,8 +133,8 @@ public function testFindByMultipleConditions()
133133
134134 $ this ->assertCount (2 , $ should_be_fyodor_and_leo );
135135
136- $ finder_2 = $ this ->pool ->find (Writer::class)->where ('`birthday` > ? ' , '1800-01-01 ' )->where ('birthday < ? ' , '1825-01-01 ' );
137- $ this ->assertEquals ("(`birthday` > '1800-01-01') AND (birthday < '1825-01-01') " , $ finder_2 ->getWhere ());
136+ $ finder_2 = $ this ->pool ->find (Writer::class)->where ('`birthday` > ? ' , '1800-01-01 ' )->where ('` birthday` < ? ' , '1825-01-01 ' );
137+ $ this ->assertEquals ("(`birthday` > '1800-01-01') AND (` birthday` < '1825-01-01') " , $ finder_2 ->getWhere ());
138138
139139 /** @var Writer[] $should_be_fyodor */
140140 $ should_be_fyodor = $ finder_2 ->all ();
You can’t perform that action at this time.
0 commit comments