| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public static function build(): array |
||
| 18 | { |
||
| 19 | return [ |
||
| 20 | 'name' => 'reconcileTransactionLine', |
||
| 21 | 'type' => Type::nonNull(_types()->getOutput(TransactionLine::class)), |
||
| 22 | 'description' => 'Update the reconcile flag of a line of transaction', |
||
| 23 | 'args' => [ |
||
| 24 | 'id' => Type::nonNull(_types()->getId(TransactionLine::class)), |
||
| 25 | 'isReconciled' => Type::nonNull(Type::boolean()), |
||
| 26 | ], |
||
| 27 | 'resolve' => function ($root, array $args, SessionInterface $session): TransactionLine { |
||
| 28 | /** @var TransactionLine $line */ |
||
| 29 | $line = $args['id']->getEntity(); |
||
| 30 | $isReconciled = (bool) $args['isReconciled']; |
||
| 31 | |||
| 32 | // Check ACL |
||
| 33 | Helper::throwIfDenied($line->getTransaction(), 'update'); |
||
| 34 | $line->setIsReconciled($isReconciled); |
||
| 35 | |||
| 36 | _em()->flush(); |
||
| 37 | |||
| 38 | return $line; |
||
| 39 | }, |
||
| 43 |