-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModel.php
More file actions
44 lines (36 loc) · 739 Bytes
/
Model.php
File metadata and controls
44 lines (36 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
declare(strict_types=1);
namespace MatchBot\Domain;
use Doctrine\ORM\Mapping as ORM;
abstract class Model
{
/**
* @var int|null
*/
#[ORM\Id]
#[ORM\Column(type: 'integer', options: ['unsigned' => true])]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected ?int $id = null;
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
public function hasBeenPersisted(): bool
{
return $this->id !== null;
}
public function __toString(): string
{
return "Instance of " . get_class($this);
}
}