Skip to content

Commit 4ba62d9

Browse files
committed
Readme update
1 parent dc0a97c commit 4ba62d9

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
3451
Finder can join a table, either by table name:
3552

3653
```php

test/src/FindTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)