PostTag::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\Entity\Blogs;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @ORM\Table(name="posts_tags", schema="posts")
9
 * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\Blogs\PostTagRepository", readOnly=true)
10
 */
11
class PostTag
12
{
13
    /**
14
     * @var int
15
     *
16
     * @ORM\Column(name="id", type="integer")
17
     * @ORM\Id
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     */
20
    private $id;
21
22
    /**
23
     * @var Post
24
     *
25
     * @ORM\ManyToOne(targetEntity="Post", inversedBy="postTags")
26
     * @ORM\JoinColumn(name="post_id", onDelete="CASCADE")
27
     */
28
    private $post;
29
30
    /**
31
     * @var Tag
32
     *
33
     * @ORM\ManyToOne(targetEntity="Tag", fetch="EAGER")
34
     * @ORM\JoinColumn(name="tag_id")
35
     */
36
    private $tag;
37
38
    /**
39
     * @var string
40
     *
41
     * @ORM\Column(name="text", type="text")
42
     */
43
    private $text;
44
45
46
    public function __construct(Post $post, Tag $tag, string $text)
47
    {
48
        $this->post = $post;
49
        $this->tag = $tag;
50
        $this->text = $text;
51
    }
52
53
    public function getId(): int
54
    {
55
        return $this->id;
56
    }
57
58
    public function getText(): string
59
    {
60
        return $this->text;
61
    }
62
63
    public function getOriginalTagText(): string
64
    {
65
        return  $this->tag->getText();
66
    }
67
68
    public function getPost(): Post
69
    {
70
        return $this->post;
71
    }
72
73
    public function getTag(): Tag
74
    {
75
        return $this->tag;
76
    }
77
}
78