1 | <?php |
||
35 | abstract class AbstractAction implements ActionInterface |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * The primary key name to use. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $primaryKeyMemberName; |
||
44 | |||
45 | /** |
||
46 | * The create processor instance. |
||
47 | * |
||
48 | * @var \TechDivision\Import\Actions\Processors\ProcessorInterface |
||
49 | */ |
||
50 | protected $createProcessor; |
||
51 | |||
52 | /** |
||
53 | * The delete processor instance. |
||
54 | * |
||
55 | * @var \TechDivision\Import\Actions\Processors\ProcessorInterface |
||
56 | */ |
||
57 | protected $deleteProcessor; |
||
58 | |||
59 | /** |
||
60 | * The update processor instance. |
||
61 | * |
||
62 | * @var \TechDivision\Import\Actions\Processors\ProcessorInterface |
||
63 | */ |
||
64 | protected $updateProcessor; |
||
65 | |||
66 | /** |
||
67 | * Initialize the instance with the passed processors. |
||
68 | * |
||
69 | * @param \TechDivision\Import\Actions\Processors\ProcessorInterface|null $createProcessor The create processor instance |
||
70 | * @param \TechDivision\Import\Actions\Processors\ProcessorInterface|null $updateProcessor The update processor instance |
||
71 | * @param \TechDivision\Import\Actions\Processors\ProcessorInterface|null $deleteProcessor The delete processor instance |
||
72 | * @param string|null $primaryKeyMemberName The primary key member name |
||
73 | */ |
||
74 | 6 | public function __construct( |
|
99 | |||
100 | /** |
||
101 | * Return's the primary key member name of the entity to persist. |
||
102 | * |
||
103 | * @return string The primary key member name |
||
104 | */ |
||
105 | 4 | public function getPrimaryKeyMemberName() |
|
109 | |||
110 | /** |
||
111 | * Set's the create processor instance. |
||
112 | * |
||
113 | * @param \TechDivision\Import\Actions\Processors\ProcessorInterface $createProcessor The create processor instance to use |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | 1 | public function setCreateProcessor(ProcessorInterface $createProcessor) |
|
121 | |||
122 | /** |
||
123 | * Return's the create processor instance. |
||
124 | * |
||
125 | * @return \TechDivision\Import\Actions\Processors\ProcessorInterface The create processor instance |
||
126 | */ |
||
127 | 1 | public function getCreateProcessor() |
|
131 | |||
132 | /** |
||
133 | * Set's the delete processor instance. |
||
134 | * |
||
135 | * @param \TechDivision\Import\Actions\Processors\ProcessorInterface $deleteProcessor The delete processor instance to use |
||
136 | * |
||
137 | * @return void |
||
138 | */ |
||
139 | 1 | public function setDeleteProcessor(ProcessorInterface $deleteProcessor) |
|
143 | |||
144 | /** |
||
145 | * Return's the delete processor instance. |
||
146 | * |
||
147 | * @return \TechDivision\Import\Actions\Processors\ProcessorInterface The delete processor instance |
||
148 | */ |
||
149 | 1 | public function getDeleteProcessor() |
|
153 | |||
154 | /** |
||
155 | * Set's the update processor instance. |
||
156 | * |
||
157 | * @param \TechDivision\Import\Actions\Processors\ProcessorInterface $updateProcessor The update processor instance to use |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | public function setUpdateProcessor(ProcessorInterface $updateProcessor) |
||
165 | |||
166 | /** |
||
167 | * Return's the update processor instance. |
||
168 | * |
||
169 | * @return \TechDivision\Import\Actions\Processors\ProcessorInterface The update processor instance |
||
170 | */ |
||
171 | public function getUpdateProcessor() |
||
175 | |||
176 | /** |
||
177 | * Helper method that create/update the passed entity, depending on |
||
178 | * the entity's status. |
||
179 | * |
||
180 | * @param array $row The entity data to create/update |
||
181 | * @param string|null $name The name of the prepared statement that has to be executed |
||
182 | * |
||
183 | * @return void |
||
184 | */ |
||
185 | public function persist(array $row, $name = null) |
||
194 | |||
195 | /** |
||
196 | * Creates's the entity with the passed attributes. |
||
197 | * |
||
198 | * @param array $row The attributes of the entity to create |
||
199 | * @param string|null $name The name of the prepared statement that has to be executed |
||
200 | * |
||
201 | * @return void |
||
202 | */ |
||
203 | 2 | public function create(array $row, $name = null) |
|
207 | |||
208 | /** |
||
209 | * Delete's the entity with the passed attributes. |
||
210 | * |
||
211 | * @param array $row The attributes of the entity to delete |
||
212 | * @param string|null $name The name of the prepared statement that has to be executed |
||
213 | * |
||
214 | * @return void |
||
215 | */ |
||
216 | 2 | public function delete(array $row, $name = null) |
|
220 | |||
221 | /** |
||
222 | * Update's the entity with the passed attributes. |
||
223 | * |
||
224 | * @param array $row The attributes of the entity to update |
||
225 | * @param string|null $name The name of the prepared statement that has to be executed |
||
226 | * |
||
227 | * @return void |
||
228 | */ |
||
229 | public function update(array $row, $name = null) |
||
233 | } |
||
234 |