1 | <?php |
||
12 | class SqlStore extends AbstractStore |
||
13 | { |
||
14 | /** |
||
15 | * @var \Aura\Sql\ExtendedPdo |
||
16 | */ |
||
17 | protected $dbal; |
||
18 | |||
19 | /** |
||
20 | * Construct. |
||
21 | * |
||
22 | * @param \Aura\Sql\ExtendedPdo $dbal |
||
23 | * @param \Aura\Filter\FilterFactory $filter |
||
24 | */ |
||
25 | public function __construct(ExtendedPdo $dbal, FilterFactory $filter) |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function create(Collection $collection, array $scopes = []) |
||
41 | |||
42 | /** |
||
43 | * Insert an entity to the database. |
||
44 | * |
||
45 | * @param \Percy\Entity\EntityInterface $entity |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | protected function insertEntity(EntityInterface $entity) |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function read(Collection $collection, array $scopes = []) |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function update(Collection $collection, array $scopes = []) |
||
76 | |||
77 | /** |
||
78 | * Update an entity in the database. |
||
79 | * |
||
80 | * @param \Percy\Entity\EntityInterface $entity |
||
81 | * |
||
82 | * @return void |
||
83 | */ |
||
84 | protected function updateEntity(EntityInterface $entity) |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function delete(Collection $collection, array $scopes = []) |
||
103 | |||
104 | /** |
||
105 | * Delete an entity from the database. Be aware, this handles hard deletes. |
||
106 | * To handle soft deletes, extend this class and overload this method. |
||
107 | * |
||
108 | * @param \Percy\Entity\EntityInterface $entity |
||
109 | * |
||
110 | * @return void |
||
111 | */ |
||
112 | protected function deleteEntity(EntityInterface $entity) |
||
120 | |||
121 | /** |
||
122 | * Iterate a collection with the correct callback. |
||
123 | * |
||
124 | * @param \Percy\Entity\Collection $collection |
||
125 | * @param string $callable |
||
126 | * |
||
127 | * @return boolean |
||
128 | */ |
||
129 | protected function collectionIterator(EntityCollection $collection, $callable) |
||
145 | } |
||
146 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: