Completed
Push — master ( b2acd3...46961e )
by Axel
03:30
created

Job::prePersist()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Developtech\AgilityBundle\Entity;
4
5
use Developtech\AgilityBundle\Model\JobModel;
6
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * @ORM\Entity()
11
 * @ORM\Table(name="developtech_agility__jobs")
12
 * @ORM\InheritanceType("JOINED")
13
 * @ORM\DiscriminatorColumn(name="type", type="string", length=2)
14
 * @ORM\DiscriminatorMap({
15
 *     "US" = "Feature",
16
 *     "FB" = "Feedback"
17
 * })
18
 * @ORM\HasLifecycleCallbacks
19
 */
20
abstract class Job extends JobModel {
21
    /**
22
     * @ORM\Column(name="id", type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    protected $id;
27
28
    /**
29
     * @ORM\Column(name="name", type="string", length=125)
30
     */
31
    protected $name;
32
33
    /**
34
     * @ORM\Column(name="slug", type="string", length=125)
35
     */
36
    protected $slug;
37
38
    /**
39
     * @ORM\Column(name="description", type="string", length=255)
40
     */
41
    protected $description;
42
43
    /**
44
     * @ORM\Column(name="status", type="integer")
45
     */
46
    protected $status;
47
48
    /**
49
     * @ORM\Column(name="createdAt", type="datetime")
50
     */
51
    protected $createdAt;
52
53
    /**
54
     * @ORM\Column(name="updatedAt", type="datetime")
55
     */
56
    protected $updatedAt;
57
58
    /**
59
     * @var Project
60
     *
61
     * @ORM\ManyToOne(targetEntity="Developtech\AgilityBundle\Entity\Project", inversedBy="feedbacks")
62
     * @ORM\JoinColumn(name="project_id", referencedColumnName="id", onDelete="CASCADE")
63
     */
64
    protected $project;
65
66
    /**
67
     * @ORM\PrePersist()
68
     */
69
    public function prePersist() {
70
        $this->createdAt = $this->updatedAt = new \DateTime();
71
    }
72
73
    /**
74
     * @ORM\PreUpdate()
75
     */
76
    public function preUpdate() {
77
        $this->updatedAt = new \DateTime();
78
    }
79
80
    /**
81
     * @param integer $id
82
     * @return FeedbackModel
83
     */
84 4
    public function setId($id) {
85 4
        $this->id = $id;
86
87 4
        return $this;
88
    }
89
90
    /**
91
     * Get id
92
     *
93
     * @return int
94
     */
95 7
    public function getId()
96
    {
97 7
        return $this->id;
98
    }
99
}
100