Completed
Push — master ( 033377...3a6d90 )
by Guillaume
12s
created

Model::setModelValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Tests;
4
5
use ETNA\Doctrine\Extensions\AutoIncrementID;
6
use ETNA\Doctrine\Extensions\CreatedAt;
7
use ETNA\Doctrine\Extensions\UpdatedAt;
8
use ETNA\Doctrine\Extensions\DoNotDelete;
9
use ETNA\Doctrine\Extensions\SetProperties;
10
11
/**
12
 * @Entity(repositoryClass="Tests\ModelRepository")
13
 * @Table(name="model")
14
 * @HasLifecycleCallbacks
15
 */
16
class Model implements \JsonSerializable
17
{
18
    use AutoIncrementID;
19
    use CreatedAt;
20
    use UpdatedAt;
21
    use DoNotDelete;
22
    use SetProperties;
23
24
    private $model_value;
25
26
    public function __construct()
27
    {
28
        $this->model_value = '';
29
    }
30
31
    public function setModelValue($value)
32
    {
33
        $this->model_value = $value;
34
    }
35
36
    public function getModelValue()
37
    {
38
        return $this->model_value;
39
    }
40
41
    public function populate($date)
42
    {
43
        $this->created_at = $this->updated_at = $this->deleted_at = $date;
44
    }
45
46
    public function jsonSerialize()
47
    {
48
        return [
49
            'id'         => $this->getId(),
50
            'created_at' => $this->getCreatedAt(),
51
            'updated_at' => $this->getUpdatedAt(),
52
            'deleted_at' => $this->getDeletedAt()
53
        ];
54
    }
55
}
56