1 | <?php |
||
13 | class SqlStore extends AbstractStore |
||
14 | { |
||
15 | /** |
||
16 | * @var \Aura\Sql\ExtendedPdo |
||
17 | */ |
||
18 | protected $dbal; |
||
19 | |||
20 | /** |
||
21 | * @var \Aura\SqlQuery\QueryFactory |
||
22 | */ |
||
23 | protected $query; |
||
24 | |||
25 | /** |
||
26 | * Construct. |
||
27 | * |
||
28 | * @param \Aura\Sql\ExtendedPdo $dbal |
||
29 | * @param \Aura\Filter\FilterFactory $filter |
||
30 | */ |
||
31 | public function __construct(ExtendedPdo $dbal, FilterFactory $filter) |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function create(Collection $collection, array $scopes = []) |
||
47 | |||
48 | /** |
||
49 | * Insert an entity to the database. |
||
50 | * |
||
51 | * @param \Percy\Entity\EntityInterface $entity |
||
52 | * @param array $scopes |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | protected function insertEntity(EntityInterface $entity, array $scopes = []) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function read(Collection $collection, array $scopes = []) |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function update(Collection $collection, array $scopes = []) |
||
83 | |||
84 | /** |
||
85 | * Update an entity in the database. |
||
86 | * |
||
87 | * @param \Percy\Entity\EntityInterface $entity |
||
88 | * @param array $scopes |
||
89 | * |
||
90 | * @return void |
||
91 | */ |
||
92 | protected function updateEntity(EntityInterface $entity, array $scopes = []) |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | public function delete(Collection $collection, array $scopes = []) |
||
110 | |||
111 | /** |
||
112 | * Delete an entity from the database. Be aware, this handles hard deletes. |
||
113 | * To handle soft deletes, extend this class and overload this method. |
||
114 | * |
||
115 | * @param \Percy\Entity\EntityInterface $entity |
||
116 | * @param array $scopes |
||
117 | * |
||
118 | * @return void |
||
119 | */ |
||
120 | protected function deleteEntity(EntityInterface $entity, array $scopes = []) |
||
131 | |||
132 | /** |
||
133 | * Iterate a collection with the correct callback. |
||
134 | * |
||
135 | * @param \Percy\Entity\Collection $collection |
||
136 | * @param string $callable |
||
137 | * |
||
138 | * @return boolean |
||
139 | */ |
||
140 | protected function collectionIterator(Collection $collection, $callable, array $scopes = []) |
||
156 | |||
157 | /** |
||
158 | * Persist relationships to data store. |
||
159 | * |
||
160 | * @param \Percy\Entity\EntityInterface $entity |
||
161 | * @param array $rels |
||
162 | * @param array $map |
||
163 | * |
||
164 | * @return void |
||
165 | */ |
||
166 | public function relationships(EntityInterface $entity, array $rels, array $map) |
||
198 | |||
199 | /** |
||
200 | * Remove relationship. |
||
201 | * |
||
202 | * @param \Percy\Entity\EntityInterface $entity |
||
203 | * @param array $rels |
||
204 | * @param array $map |
||
205 | * |
||
206 | * @return void |
||
207 | */ |
||
208 | public function deleteRelationship(EntityInterface $entity, array $rels, array $map) |
||
226 | |||
227 | /** |
||
228 | * Update a relationship. |
||
229 | * |
||
230 | * @param \Percy\Entity\EntityInterface $entity |
||
231 | * @param array $rels |
||
232 | * @param array $map |
||
233 | * |
||
234 | * @return void |
||
235 | */ |
||
236 | public function updateRelationship(EntityInterface $entity, array $rels, array $map) |
||
258 | } |
||
259 |