| Conditions | 3 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function perform(AgentInterface $agent, string $classFqn, array $identifiers, array $options): ActionResponseInterface |
||
| 16 | { |
||
| 17 | $collection = $agent->findMany($identifiers, $classFqn); |
||
| 18 | |||
| 19 | $errors = []; |
||
| 20 | $affected = count($collection); |
||
| 21 | |||
| 22 | try { |
||
| 23 | foreach ($collection as $object) { |
||
| 24 | $agent->remove($object); |
||
| 25 | } |
||
| 26 | $agent->flush(); |
||
| 27 | } catch (\Exception $e) { |
||
| 28 | $errors[] = $e->getMessage(); |
||
| 29 | $affected = 0; |
||
| 30 | } |
||
| 31 | |||
| 32 | return ActionResponse::create([ |
||
| 33 | 'errors' => $errors, |
||
| 34 | 'affected' => $affected, |
||
| 35 | ]); |
||
| 36 | } |
||
| 37 | |||
| 42 |