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 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | protected function insertEntity(EntityInterface $entity) |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | public function read(Collection $collection, array $scopes = []) |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | public function update(Collection $collection, array $scopes = []) |
||
81 | |||
82 | /** |
||
83 | * Update an entity in the database. |
||
84 | * |
||
85 | * @param \Percy\Entity\EntityInterface $entity |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | protected function updateEntity(EntityInterface $entity) |
||
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | public function delete(Collection $collection, array $scopes = []) |
||
107 | |||
108 | /** |
||
109 | * Delete an entity from the database. Be aware, this handles hard deletes. |
||
110 | * To handle soft deletes, extend this class and overload this method. |
||
111 | * |
||
112 | * @param \Percy\Entity\EntityInterface $entity |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | protected function deleteEntity(EntityInterface $entity) |
||
124 | |||
125 | /** |
||
126 | * Iterate a collection with the correct callback. |
||
127 | * |
||
128 | * @param \Percy\Entity\Collection $collection |
||
129 | * @param string $callable |
||
130 | * |
||
131 | * @return boolean |
||
132 | */ |
||
133 | protected function collectionIterator(Collection $collection, $callable) |
||
149 | |||
150 | /** |
||
151 | * Persist relationships to data store. |
||
152 | * |
||
153 | * @param \Percy\Entity\EntityInterface $entity |
||
154 | * @param array $rels |
||
155 | * @param array $map |
||
156 | * |
||
157 | * @return void |
||
158 | */ |
||
159 | public function relationships(EntityInterface $entity, array $rels, array $map) |
||
178 | } |
||
179 |