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