1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Basis; |
4
|
|
|
|
5
|
|
|
use Tarantool\Mapper\Mapper; |
6
|
|
|
|
7
|
|
|
abstract class Job |
8
|
|
|
{ |
9
|
|
|
private $app; |
10
|
|
|
|
11
|
5 |
|
public function __construct(Application $app) |
12
|
|
|
{ |
13
|
5 |
|
$this->app = $app; |
14
|
5 |
|
} |
15
|
|
|
|
16
|
|
|
public function create($space, $data) |
17
|
|
|
{ |
18
|
|
|
return $this->get(Mapper::class)->create($space, $data); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function dispatch($job, $params = []) |
22
|
|
|
{ |
23
|
|
|
return $this->app->dispatch($job, $params); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function fire($event, $context) |
27
|
|
|
{ |
28
|
|
|
return $this->get(Event::class)->fire($event, $context); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function get($class) |
32
|
|
|
{ |
33
|
|
|
return $this->app->get($class); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function find($space, $params = []) |
37
|
|
|
{ |
38
|
|
|
return $this->get(Mapper::class)->find($space, $params); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function findOrCreate($space, $params = []) |
42
|
|
|
{ |
43
|
|
|
return $this->get(Mapper::class)->findOrCreate($space, $params); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function findOne($space, $params = []) |
47
|
|
|
{ |
48
|
|
|
return $this->get(Mapper::class)->findOne($space, $params); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function findOrFail($space, $params = []) |
52
|
|
|
{ |
53
|
|
|
return $this->get(Mapper::class)->findOrFail($space, $params); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function remove($space, $params = []) |
57
|
|
|
{ |
58
|
|
|
return $this->get(Mapper::class)->remove($space, $params); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|