Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 19 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function process(ResultInterface $result) |
|
26 | { |
||
27 | 3 | $result->setActionStartTime($this->getCode(), new \DateTime()); |
|
28 | 3 | foreach ($this->bag as $unit) { |
|
29 | 3 | if ($unit->getTmpTable() === null) { |
|
30 | 1 | throw new WrongContextException(sprintf( |
|
31 | 1 | "Action can not be used for current unit %s. Tmp table is missing.", |
|
32 | 1 | $unit->getCode() |
|
33 | 1 | )); |
|
34 | } |
||
35 | $args = [ |
||
36 | 2 | $unit->getTable(), |
|
37 | 2 | $unit->getTmpTable() |
|
38 | 2 | ]; |
|
39 | 2 | if ($unit->getPk() !== null) { |
|
40 | 1 | $args[] = $unit->getPk(); |
|
41 | 1 | } |
|
42 | 2 | $rowsDeleted = call_user_func_array([$this->resource, 'deleteUsingTempPK'], $args); |
|
43 | 2 | $result->incrementActionProcessed($this->getCode(), $rowsDeleted); |
|
44 | 2 | } |
|
45 | 2 | $result->setActionEndTime($this->getCode(), new \DateTime()); |
|
46 | 2 | } |
|
47 | |||
56 |