Item::setId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * AnimeDb package
4
 *
5
 * @package   AnimeDb
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2011, Peter Gribanov
8
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
9
 */
10
11
namespace AnimeDb\Bundle\MyAnimeListSyncBundle\Entity;
12
13
use Doctrine\ORM\Mapping as ORM;
14
use AnimeDb\Bundle\CatalogBundle\Entity\Item as CatalogItem;
15
16
/**
17
 * Items in MyAnimeList
18
 *
19
 * @ORM\Entity(repositoryClass="AnimeDb\Bundle\MyAnimeListSyncBundle\Repository\ItemRepository")
20
 * @ORM\Table(
21
 *   name="my_anime_list_item",
22
 *   uniqueConstraints={
23
 *     @ORM\UniqueConstraint(name="my_anime_list_item_idx", columns={"mal_item_id", "item_id"})
24
 *   }
25
 * )
26
 *
27
 * @package AnimeDb\Bundle\MyAnimeListSyncBundle\Entity
28
 * @author  Peter Gribanov <[email protected]>
29
 */
30
class Item
31
{
32
    /**
33
     * @ORM\Id
34
     * @ORM\Column(type="integer", name="mal_item_id")
35
     *
36
     * @var int
37
     */
38
    protected $id;
39
40
    /**
41
     * @ORM\OneToOne(targetEntity="AnimeDb\Bundle\CatalogBundle\Entity\Item")
42
     * @ORM\JoinColumn(name="item_id", referencedColumnName="id", nullable=false)
43
     *
44
     * @var CatalogItem
45
     */
46
    protected $item;
47
48
    /**
49
     * @param int $id
50
     *
51
     * @return Item
52
     */
53
    public function setId($id)
54
    {
55
        $this->id = $id;
56
        return $this;
57
    }
58
59
    /**
60
     * @return int
61
     */
62
    public function getId()
63
    {
64
        return $this->id;
65
    }
66
67
    /**
68
     * @param CatalogItem $item
69
     *
70
     * @return Item
71
     */
72
    public function setItem(CatalogItem $item)
73
    {
74
        $this->item = $item;
75
        return $this;
76
    }
77
78
    /**
79
     * @return CatalogItem
80
     */
81
    public function getItem()
82
    {
83
        return $this->item;
84
    }
85
}
86