1 | <?php |
||
20 | class Factory |
||
21 | { |
||
22 | /** |
||
23 | * Collection name. |
||
24 | */ |
||
25 | public const COLLECTION_NAME = 'access_rules'; |
||
26 | |||
27 | /** |
||
28 | * Database. |
||
29 | * |
||
30 | * @var Database |
||
31 | */ |
||
32 | protected $db; |
||
33 | |||
34 | /** |
||
35 | * Resource factory. |
||
36 | * |
||
37 | * @var ResourceFactory |
||
38 | */ |
||
39 | protected $resource_factory; |
||
40 | |||
41 | /** |
||
42 | * Initialize. |
||
43 | */ |
||
44 | public function __construct(Database $db, ResourceFactory $resource_factory) |
||
49 | |||
50 | /** |
||
51 | * Has resource. |
||
52 | */ |
||
53 | public function has(string $name): bool |
||
57 | |||
58 | /** |
||
59 | * Get resources. |
||
60 | */ |
||
61 | public function getAll(?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
69 | |||
70 | /** |
||
71 | * Get resource. |
||
72 | */ |
||
73 | public function getOne(string $name): AccessRuleInterface |
||
87 | |||
88 | /** |
||
89 | * Delete by name. |
||
90 | */ |
||
91 | public function deleteOne(string $name): bool |
||
98 | |||
99 | /** |
||
100 | * Add resource. |
||
101 | */ |
||
102 | public function add(array $resource): ObjectIdInterface |
||
113 | |||
114 | /** |
||
115 | * Update. |
||
116 | */ |
||
117 | public function update(AccessRuleInterface $resource, array $data): bool |
||
125 | |||
126 | /** |
||
127 | * Change stream. |
||
128 | */ |
||
129 | public function watch(?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
137 | |||
138 | /** |
||
139 | * Build instance. |
||
140 | */ |
||
141 | public function build(array $resource): AccessRuleInterface |
||
145 | } |
||
146 |