Skip to content

Commit

Permalink
Fix PHP syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
chinpei215 committed Dec 25, 2015
1 parent 17e6959 commit 00b0b8d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -30,11 +30,11 @@ You can start stacking finders by calling `q()`, and you can execute the query a
Note that `q()` method returns an instance of `StackableFinder`. The object also has `find()` method like a Model - so you can use fluent interface, but it is not a sub-class of Model.

So you cannot call any other methods implemented by Model.
```
```php
$this->Article->->q()->read(); // Error
```
Instead, you can use `where()` or some other 3.x compatible methods for building queries.
```
```php
$articles = $this->Article->q()
->select(['Article.id', 'Article.title'])
->contain('Author')
Expand All @@ -48,7 +48,7 @@ $articles = $this->Article->q()
### Subqueries

You can make subqueries like the following:
```
```php
$q = $this->User->q()->select('id');

$articles = $this->Article->q()
Expand All @@ -67,7 +67,7 @@ It is not compatible with 3.x but it is nessecary at this time in 2.x.
As mentioned above, you can do it by calling `exec()` but there are some other ways to get the results of the query.

You can iterate the `StackableFinder` object directly.
```
```php
$q = $this->Article->q()->find('list');
foreach ($q as $id => $title) {
// ...
Expand All @@ -91,7 +91,7 @@ But, note that stacking `find('first')` or `first()` after `find('list')` doesn'
Because `_findFirst()` doen't returns the _first_ result actually. That returns the element with index `0`.

So this is a bad example:
```
```php
$articles = $this->Article->q()
->find('list')
->first();
Expand Down

0 comments on commit 00b0b8d

Please sign in to comment.