Completed
Push — feature/fixing_cost ( ef981e )
by Laurent
01:53
created

FlightDamageRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace FlightLog\Infrastructure\Damage\Repository;
5
6
use FlightLog\Domain\Damage\FlightDamage;
7
use FlightLog\Infrastructure\Common\Repository\AbstractDomainRepository;
8
9
final class FlightDamageRepository extends AbstractDomainRepository
10
{
11
12
    /**
13
     * @param \DoliDB $db
14
     */
15
    public function __construct(\DoliDB $db)
16
    {
17
        parent::__construct($db, 'bbc_flight_damages');
18
    }
19
20
    /**
21
     * @param FlightDamage $flightDamage
22
     *
23
     * @throws \Exception
24
     */
25
    public function save(FlightDamage $flightDamage)
26
    {
27
        $this->write([
28
            'flight_id' => $flightDamage->getFlightId()->getId(),
29
            'billed' => $flightDamage->isBilled(),
30
            'amount' => $flightDamage->amount()->getValue(),
31
            'author_id' => $flightDamage->getAuthor()->getId()
32
        ]);
33
    }
34
35
}