Total Complexity | 2 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
17 | final class UserPost |
||
18 | { |
||
19 | /** |
||
20 | * @var int |
||
21 | * |
||
22 | * @ORM\Column(type="integer", options={"unsigned" = true}) |
||
23 | * @ORM\Id |
||
24 | */ |
||
25 | private $user_id; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | * |
||
30 | * @ORM\Column(type="integer", options={"unsigned" = true}) |
||
31 | * @ORM\Id |
||
32 | */ |
||
33 | private $post_id; |
||
34 | |||
35 | /** |
||
36 | * @var datetime |
||
37 | * |
||
38 | * @ORM\Column(name="created_at", type="datetime") |
||
39 | */ |
||
40 | private $createdAt; |
||
41 | |||
42 | /** |
||
43 | * Constructor |
||
44 | * |
||
45 | * @param null|int $id |
||
46 | */ |
||
47 | public function __construct(?array $id = []) |
||
48 | { |
||
49 | // This is a bad idea in real world, but we are just testing stuff here |
||
50 | $this->user_id = $id['user_id']; |
||
51 | $this->post_id = $id['post_id']; |
||
52 | $this->createdAt = new DateTime(); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Get the date the record was created |
||
57 | * |
||
58 | * @return datetime |
||
59 | */ |
||
60 | public function getCreatedAt(): datetime |
||
63 | } |
||
64 | } |
||
65 |