Category   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 72
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getParent() 0 4 1
A getPath() 0 4 1
1
<?php
2
3
namespace Zenify\DoctrineExtensionsTree\Tests\Project\Entities;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
8
9
/**
10
 * @ORM\Entity(repositoryClass="Zenify\DoctrineExtensionsTree\Tests\Project\Model\CategoryTree")
11
 * @Gedmo\Tree(type="materializedPath")
12
 */
13
class Category
14
{
15
16
	/**
17
	 * @ORM\Column(type="integer")
18
	 * @ORM\Id
19
	 * @ORM\GeneratedValue
20
	 * @var int
21
	 */
22
	public $id;
23
24
	/**
25
	 * @Gedmo\TreePathSource
26
	 * @ORM\Column(type="string")
27
	 * @var string
28
	 */
29
	private $name;
30
31
	/**
32
	 * @Gedmo\TreeParent
33
	 * @ORM\ManyToOne(targetEntity="Category", cascade={"persist"})
34
	 * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=TRUE)
35
	 * @var Category
36
	 */
37
	private $parent;
38
39
	/**
40
	 * @Gedmo\TreePath(separator="|")
41
	 * @ORM\Column(type="string", nullable=TRUE)
42
	 * @var string
43
	 */
44
	private $path;
45
46
47
	/**
48
	 * @param string $name
49
	 * @param Category $parent
50
	 */
51
	public function __construct($name, Category $parent = NULL)
52
	{
53
		$this->name = $name;
54
		$this->parent = $parent;
55
	}
56
57
58
	/**
59
	 * @return string
60
	 */
61
	public function getName()
62
	{
63
		return $this->name;
64
	}
65
66
67
	/**
68
	 * @return Category
69
	 */
70
	public function getParent()
71
	{
72
		return $this->parent;
73
	}
74
75
76
	/**
77
	 * @return string
78
	 */
79
	public function getPath()
80
	{
81
		return $this->path;
82
	}
83
84
}
85