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

Project::preUpdate()   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
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Developtech\AgilityBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
use Developtech\AgilityBundle\Model\ProjectModel;
8
9
/**
10
 * @ORM\Entity(repositoryClass="Developtech\AgilityBundle\Repository\ProjectRepository")
11
 * @ORM\Table(name="developtech_agility__projects")
12
 * @ORM\HasLifecycleCallbacks()
13
 */
14
class Project extends ProjectModel
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     * @ORM\Column(type="integer")
20
     */
21
    protected $id;
22
23
    /**
24
     * @var string
25
     *
26
     * @ORM\Column(name="name", type="string", length=125, unique=true)
27
     */
28
    protected $name;
29
30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(name="slug", type="string", length=125, unique=true)
34
     */
35
    protected $slug;
36
37
    /**
38
     * @ORM\Column(name="description", type="text")
39
     */
40
    protected $description;
41
42
    /**
43
     * @ORM\Column(name="created_at", type="datetime")
44
     */
45
    protected $createdAt;
46
47
    /**
48
     * @ORM\Column(name="nbBetaTesters", type="integer")
49
     */
50
    protected $nbBetaTesters;
51
52
    /**
53
     * @ORM\Column(name="betaTestStatus", type="string", length=12)
54
     */
55
    protected $betaTestStatus;
56
57
    /**
58
     * @ORM\OneToMany(targetEntity="Developtech\AgilityBundle\Entity\Feature", mappedBy="project")
59
     */
60
    protected $features;
61
62
    /**
63
     * @ORM\OneToMany(targetEntity="Developtech\AgilityBundle\Entity\Feedback", mappedBy="project")
64
     */
65
    protected $feedbacks;
66
67
    /**
68
     * @ORM\PrePersist()
69
     */
70
    public function prePersist() {
71
        $this->createdAt = new \DateTime();
72
    }
73
74
    /**
75
     * @ORM\PreUpdate()
76
     */
77
    public function preUpdate() {
78
        $this->updatedAt = new \DateTime();
0 ignored issues
show
Bug introduced by
The property updatedAt does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
79
    }
80
81
    /**
82
     * @param integer $id
83
     * @return Project
84
     */
85 4
    public function setId($id) {
86 4
        $this->id = $id;
87
88 4
        return $this;
89
    }
90
91
    /**
92
     * Get id
93
     *
94
     * @return int
95
     */
96 3
    public function getId()
97
    {
98 3
        return $this->id;
99
    }
100
}
101