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