Skip to content

Commit

Permalink
📝 files/user disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
bnomei committed Jul 1, 2024
1 parent 0d4d2f5 commit 1d3b4d9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class DefaultPage extends \Kirby\Cms\Page
}
```

> Note: You can also use the trait for user models. File models are patched automatically.
> [!NOTE]
> You can also use the trait for user models. File models are patched automatically.
## Kirby's Content goes NoSQL

Expand All @@ -84,19 +85,26 @@ $page = khulan(['uuid' => 'page://betterharder']);
$pages = khulan(['template' => 'post']);
```

### Special Fields with [] and [,]
> [!WARNING]
> The khulan()-helper is currently only tested for Pages. Files and Users might work or not.
### Special Fields with [], {} and [,]

The plugin creates modified copies of a few field types to make the YAML based content from Kirby ready for queries.
You can use

- `fieldname[]` to query for a value in an array from pages/files/user fields and
- `fieldname{}` to query for an objectId in an array from pages/files/user fields and
- `fieldname[,]` to query for fields in comma separated strings like tags/select/radio/checkbox/multiselect fields.

```php
// find all pages that have another page linked
$pages = khulan([
'related[]' => ['$in' => ['page://fasterstronger']],
]);
$pages = khulan([
'related{}' => ['$in' => ['dc9f7835c2400cc4']], // objectId
]);

// find all products in the category 'books' or 'movies'
// that had been modified within the last 7 days
Expand Down

0 comments on commit 1d3b4d9

Please sign in to comment.