1 | <?php |
||
12 | class SqlStore extends AbstractStore |
||
13 | { |
||
14 | /** |
||
15 | * @var \Aura\Sql\ExtendedPdo |
||
16 | */ |
||
17 | protected $dbal; |
||
18 | |||
19 | /** |
||
20 | * @var \Aura\SqlQuery\QueryFactory |
||
21 | */ |
||
22 | protected $query; |
||
23 | |||
24 | /** |
||
25 | * Construct. |
||
26 | * |
||
27 | * @param \Aura\Sql\ExtendedPdo $dbal |
||
28 | * @param \Aura\Filter\FilterFactory $filter |
||
29 | */ |
||
30 | public function __construct(ExtendedPdo $dbal, FilterFactory $filter) |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | public function create(Collection $collection, array $scopes = []) |
||
46 | |||
47 | /** |
||
48 | * Insert an entity to the database. |
||
49 | * |
||
50 | * @param \Percy\Entity\EntityInterface $entity |
||
51 | * @param array $scopes |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | protected function insertEntity(EntityInterface $entity, array $scopes = []) |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | public function read(Collection $collection, array $scopes = []) |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function update(Collection $collection, array $scopes = []) |
||
82 | |||
83 | /** |
||
84 | * Update an entity in the database. |
||
85 | * |
||
86 | * @param \Percy\Entity\EntityInterface $entity |
||
87 | * @param array $scopes |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | protected function updateEntity(EntityInterface $entity, array $scopes = []) |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function delete(Collection $collection, array $scopes = []) |
||
109 | |||
110 | /** |
||
111 | * Delete an entity from the database. Be aware, this handles hard deletes. |
||
112 | * To handle soft deletes, extend this class and overload this method. |
||
113 | * |
||
114 | * @param \Percy\Entity\EntityInterface $entity |
||
115 | * @param array $scopes |
||
116 | * |
||
117 | * @return void |
||
118 | */ |
||
119 | protected function deleteEntity(EntityInterface $entity, array $scopes = []) |
||
130 | |||
131 | /** |
||
132 | * Iterate a collection with the correct callback. |
||
133 | * |
||
134 | * @param \Percy\Entity\Collection $collection |
||
135 | * @param string $callable |
||
136 | * |
||
137 | * @return boolean |
||
138 | */ |
||
139 | protected function collectionIterator(Collection $collection, $callable, array $scopes = []) |
||
155 | |||
156 | /** |
||
157 | * Persist relationships to data store. |
||
158 | * |
||
159 | * @param \Percy\Entity\EntityInterface $entity |
||
160 | * @param array $rels |
||
161 | * @param array $map |
||
162 | * |
||
163 | * @return void |
||
164 | */ |
||
165 | public function relationships(EntityInterface $entity, array $rels, array $map) |
||
184 | |||
185 | /** |
||
186 | * Remove relationships. |
||
187 | * |
||
188 | * @param \Percy\Entity\EntityInterface $entity |
||
189 | * @param array $rels |
||
190 | * @param array $map |
||
191 | * |
||
192 | * @return void |
||
193 | */ |
||
194 | public function deleteRelationships(EntityInterface $entity, array $rels, array $map) |
||
209 | } |
||
210 |