Test Setup Failed
Push — dependabot/composer/thomaspark... ( 7e28e7...04472a )
by
unknown
37:44 queued 28:26
created

SearchStatEntity::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\SearchModule\Entity;
15
16
use DateTime;
17
use DateTimeZone;
18
use Doctrine\ORM\Mapping as ORM;
19
use Symfony\Component\Validator\Constraints as Assert;
20
use Zikula\Bundle\CoreBundle\Doctrine\EntityAccess;
21
22
/**
23
 * SearchStat
24
 *
25
 * @ORM\Entity(repositoryClass="Zikula\SearchModule\Entity\Repository\SearchStatRepository")
26
 * @ORM\Table(name="search_stat")
27
 */
28
class SearchStatEntity extends EntityAccess
29
{
30
    /**
31
     * id of the previous search
32
     *
33
     * @ORM\Column(name="id", type="integer", nullable=false)
34
     * @ORM\Id
35
     * @ORM\GeneratedValue(strategy="IDENTITY")
36
     * @var int
37
     */
38
    private $id;
39
40
    /**
41
     * search terms of the previous search
42
     *
43
     * @ORM\Column(name="search", type="string", length=50, nullable=false)
44
     * @Assert\Length(min="1", max="50")
45
     * @var string
46
     */
47
    private $search;
48
49
    /**
50
     * Number of times previous search has been run
51
     *
52
     * @ORM\Column(name="scount", type="integer", nullable=false)
53
     * @Assert\NotNull
54
     * @var int
55
     */
56
    private $scount;
57
58
    /**
59
     * Timestamp of last time this search was run
60
     *
61
     * @ORM\Column(name="date", type="date", nullable=true)
62
     * @var DateTime
63
     */
64
    private $date;
65
66
    public function __construct()
67
    {
68
        $this->search = '';
69
        $this->scount = 0;
70
        $this->date = new DateTime('now', new DateTimeZone('UTC'));
71
    }
72
73
    public function getId(): ?int
74
    {
75
        return $this->id;
76
    }
77
78
    public function setId(int $id): self
79
    {
80
        $this->id = $id;
81
82
        return $this;
83
    }
84
85
    public function getSearch(): string
86
    {
87
        return $this->search;
88
    }
89
90
    public function setSearch(string $search): self
91
    {
92
        $this->search = $search;
93
94
        return $this;
95
    }
96
97
    public function getCount(): int
98
    {
99
        return $this->scount;
100
    }
101
102
    public function setCount(int $scount): self
103
    {
104
        $this->scount = $scount;
105
106
        return $this;
107
    }
108
109
    public function incrementCount(): void
110
    {
111
        $this->scount++;
112
    }
113
114
    public function getDate(): DateTime
115
    {
116
        return $this->date;
117
    }
118
119
    public function setDate(DateTime $date): self
120
    {
121
        $this->date = $date;
122
123
        return $this;
124
    }
125
}
126