1 | <?php |
||
25 | class Factory extends ResourceFactory |
||
26 | { |
||
27 | /** |
||
28 | * Collection name. |
||
29 | */ |
||
30 | public const COLLECTION_NAME = 'collections'; |
||
31 | |||
32 | /** |
||
33 | * Object factory. |
||
34 | * |
||
35 | * @var DataObjectFactory |
||
36 | */ |
||
37 | protected $object_factory; |
||
38 | |||
39 | /** |
||
40 | * Endpoint. |
||
41 | * |
||
42 | * @var EndpointFactory |
||
43 | */ |
||
44 | protected $endpoint_factory; |
||
45 | |||
46 | /** |
||
47 | * Initialize. |
||
48 | */ |
||
49 | 11 | public function __construct(Database $db, EndpointFactory $endpoint_factory, DataObjectFactory $object_factory, LoggerInterface $logger) |
|
55 | |||
56 | /** |
||
57 | * Has namespace. |
||
58 | */ |
||
59 | 9 | public function has(ResourceNamespaceInterface $namespace, string $name): bool |
|
66 | |||
67 | /** |
||
68 | * Get all. |
||
69 | */ |
||
70 | 3 | public function getAll(ResourceNamespaceInterface $namespace, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
|
86 | |||
87 | /** |
||
88 | * Get one. |
||
89 | */ |
||
90 | 4 | public function getOne(ResourceNamespaceInterface $namespace, string $name): CollectionInterface |
|
105 | |||
106 | /** |
||
107 | * Delete by name. |
||
108 | */ |
||
109 | 2 | public function deleteOne(ResourceNamespaceInterface $namespace, string $name): bool |
|
115 | |||
116 | /** |
||
117 | * Add namespace. |
||
118 | */ |
||
119 | 8 | public function add(ResourceNamespaceInterface $namespace, array $resource): ObjectIdInterface |
|
132 | |||
133 | /** |
||
134 | * Update. |
||
135 | */ |
||
136 | public function update(CollectionInterface $resource, array $data): bool |
||
144 | |||
145 | /** |
||
146 | * Change stream. |
||
147 | */ |
||
148 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
154 | |||
155 | /** |
||
156 | * Build instance. |
||
157 | */ |
||
158 | 5 | public function build(array $resource, ResourceNamespaceInterface $namespace): CollectionInterface |
|
164 | } |
||
165 |