|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Application\Model; |
|
6
|
|
|
|
|
7
|
|
|
use Application\Repository\DatingRepository; |
|
8
|
|
|
use Application\Utility; |
|
9
|
|
|
use Cake\Chronos\Chronos; |
|
|
|
|
|
|
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
11
|
|
|
use GraphQL\Doctrine\Attribute as API; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* An exact dating period expressed in Julian Days and automatically computed |
|
15
|
|
|
* from an approximate, lose string value. |
|
16
|
|
|
* |
|
17
|
|
|
* Julian days are used instead of standard date format because MariaDB does not |
|
18
|
|
|
* support older year than 1000 and we are often much older than that (before Christ) |
|
19
|
|
|
*/ |
|
20
|
|
|
#[ORM\Entity(DatingRepository::class)] |
|
21
|
|
|
class Dating extends AbstractModel |
|
22
|
|
|
{ |
|
23
|
|
|
#[ORM\Column(name: '`from`', type: 'integer')] |
|
24
|
|
|
private int $from; |
|
25
|
|
|
|
|
26
|
|
|
#[ORM\Column(name: '`to`', type: 'integer')] |
|
27
|
|
|
private int $to; |
|
28
|
|
|
|
|
29
|
|
|
#[ORM\JoinColumn(onDelete: 'CASCADE', nullable: false)] |
|
30
|
|
|
#[ORM\ManyToOne(targetEntity: Card::class, inversedBy: 'datings')] |
|
31
|
|
|
private ?Card $card = null; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Return the automatically computed beginning of dating period. |
|
35
|
|
|
*/ |
|
36
|
40 |
|
public function getFrom(): Chronos |
|
37
|
|
|
{ |
|
38
|
40 |
|
return Utility::julianToDate($this->from); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
41 |
|
#[API\Exclude] |
|
42
|
|
|
public function setFrom(Chronos $from): void |
|
43
|
|
|
{ |
|
44
|
41 |
|
$this->from = Utility::dateToJulian($from); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Return the automatically computed end of dating period. |
|
49
|
|
|
*/ |
|
50
|
39 |
|
public function getTo(): Chronos |
|
51
|
|
|
{ |
|
52
|
39 |
|
return Utility::julianToDate($this->to); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
41 |
|
#[API\Exclude] |
|
56
|
|
|
public function setTo(Chronos $to): void |
|
57
|
|
|
{ |
|
58
|
41 |
|
$this->to = Utility::dateToJulian($to); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
1 |
|
public function getCard(): Card |
|
62
|
|
|
{ |
|
63
|
1 |
|
return $this->card; |
|
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
4 |
|
public function setCard(Card $card): void |
|
67
|
|
|
{ |
|
68
|
4 |
|
if ($this->card) { |
|
69
|
1 |
|
$this->card->datingRemoved($this); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
4 |
|
$this->card = $card; |
|
73
|
4 |
|
$this->card->datingAdded($this); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths