Skip to content

Commit 74cca70

Browse files
authored
prettify sequence example
1 parent d0494bd commit 74cca70

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

README.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,20 @@ $mapper->get('shift_pattern', 1)->pattern[5]; // read element with index 5 from
204204
If you want you can use sequence plugin that generates next value based on sequence space.
205205
Or you can implement id generator using any other source, for example with raft protocol.
206206
```php
207-
$pattern = $mapper->getSchema()->createSpace('shift_pattern');
208-
$pattern->addProperty('id', 'unsigned');
209-
$pattern->addProperty('title', 'str');
210-
$pattern->addProperty('pattern', '*');
211-
$pattern->addIndex('id');
207+
$post = $mapper->getSchema()->createSpace('post');
208+
$post->addProperty('id', 'unsigned');
209+
$post->addProperty('title', 'str');
210+
$post->addProperty('body', 'str');
211+
$post->addIndex('id');
212212

213213
$mappr->addPlugin(Tarantool\Mapper\Plugins\Sequence::class);
214214

215-
$pattern = $mapper->create('shift_pattern', [
216-
'title' => '5 days week',
217-
'pattern' => [
218-
['work' => true],
219-
['work' => true],
220-
['work' => true],
221-
['work' => true],
222-
['work' => true],
223-
['work' => false],
224-
['work' => false],
225-
]
215+
$entity = $mapper->create('post', [
216+
'title' => 'Autoincrement implemented',
217+
'body' => 'You can use Sequence plugin to track and fill your entity id'
226218
]);
227219

228-
echo $pattern->id; // will be set when you create an instance
220+
echo $entity->id; // will be set when you create an instance
229221
```
230222

231223
# User-defined classes plugin

0 commit comments

Comments
 (0)