-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
26 lines (19 loc) · 861 Bytes
/
test.php
File metadata and controls
26 lines (19 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Bottledcode\DurablePhp\Events\EventDescription;
use Bottledcode\DurablePhp\Events\RaiseEvent;
use Bottledcode\DurablePhp\Events\WithEntity;
use Bottledcode\DurablePhp\Glue\Provenance;
use Bottledcode\DurablePhp\State\Ids\StateId;
use Bottledcode\DurablePhp\State\Serializer;
use function Bottledcode\DurablePhp\EntityId;
use function Bottledcode\DurablePhp\ext\emit_event;
$user = new Provenance('rob', ['admin']);
$user = Serializer::serialize($user);
$event = WithEntity::forInstance(
StateId::fromEntityId(EntityId('test', 'test')),
RaiseEvent::forTimer('ident')
);
$event = new EventDescription($event);
echo emit_event($user, $event->toArray(), StateId::fromEntityId(EntityId('test', 'test')));
// echo emit_event(['userId' => 'bob', 'roles' => ['admin']], [], 'activity:bullshit');