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

FlightDamageRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A save() 0 9 1
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
}