aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/Change.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Change.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Change.php86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Change.php b/src/Wallabag/CoreBundle/Entity/Change.php
new file mode 100644
index 00000000..203a2d31
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Change.php
@@ -0,0 +1,86 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Change.
9 *
10 * This entity stores a datetime for each event (updated or tagged) done on an entry.
11 *
12 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ChangeRepository")
13 * @ORM\Table(name="`change`")
14 */
15class Change
16{
17 const MODIFIED_TYPE = 1;
18 const CHANGED_TAG_TYPE = 2;
19
20 /**
21 * @var int
22 *
23 * @ORM\Column(type="integer")
24 * @ORM\Id
25 * @ORM\GeneratedValue(strategy="AUTO")
26 */
27 private $id;
28
29 /**
30 * @var int
31 *
32 * @ORM\Column(type="integer")
33 */
34 private $type;
35
36 /**
37 * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="changes")
38 */
39 private $entry;
40
41 /**
42 * @var \DateTime
43 *
44 * @ORM\Column(name="created_at", type="datetime")
45 */
46 private $createdAt;
47
48 public function __construct($type, Entry $entry)
49 {
50 $this->type = $type;
51 $this->entry = $entry;
52 $this->createdAt = new \DateTime();
53 }
54
55 /**
56 * @return int
57 */
58 public function getId()
59 {
60 return $this->id;
61 }
62
63 /**
64 * @return int
65 */
66 public function getType()
67 {
68 return $this->type;
69 }
70
71 /**
72 * @return DateTime
73 */
74 public function getCreatedAt()
75 {
76 return $this->createdAt;
77 }
78
79 /**
80 * @return Entry
81 */
82 public function getEntry()
83 {
84 return $this->entry;
85 }
86}