|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
6
|
|
|
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\RenderableInterface; |
|
7
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
8
|
|
|
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Traits\TemplateTrait; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Manager for Class constructor |
|
12
|
|
|
* |
|
13
|
|
|
* @author Sławomir Kania <[email protected]> |
|
14
|
|
|
*/ |
|
15
|
|
|
class ClassConstructorManager implements RenderableInterface |
|
16
|
|
|
{ |
|
17
|
|
|
use TemplateTrait; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Constructor for this class |
|
21
|
|
|
* |
|
22
|
|
|
* @Assert\NotNull(message="Constructor has to know about class!") |
|
23
|
|
|
* @Assert\Valid() |
|
24
|
|
|
* @var ClassManager |
|
25
|
|
|
*/ |
|
26
|
|
|
private $classManager = null; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Init Properties for constructor |
|
30
|
|
|
* |
|
31
|
|
|
* @Assert\NotNull(message="InitProperties can not be null!") |
|
32
|
|
|
* @Assert\Valid() |
|
33
|
|
|
* @var ArrayCollection |
|
34
|
|
|
*/ |
|
35
|
|
|
private $initProperties = null; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Constructor |
|
39
|
|
|
* |
|
40
|
|
|
* @param ClassManager $classManager |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct(ClassManager $classManager) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->setInitProperties(new ArrayCollection()); |
|
45
|
|
|
$this->setClassManager($classManager); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return ClassManager |
|
50
|
|
|
*/ |
|
51
|
|
|
public function getClassManager() |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->classManager; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param ClassManager $classManager |
|
58
|
|
|
*/ |
|
59
|
|
|
public function setClassManager(ClassManager $classManager) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->classManager = $classManager; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return ArrayCollection |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getInitProperties() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->initProperties; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param ClassManager $initProperties |
|
74
|
|
|
*/ |
|
75
|
|
|
public function setInitProperties(ArrayCollection $initProperties) |
|
76
|
|
|
{ |
|
77
|
|
|
$this->initProperties = $initProperties; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Return set of tags used in template |
|
82
|
|
|
* |
|
83
|
|
|
* @return array |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getTemplateTags() |
|
86
|
|
|
{ |
|
87
|
|
|
return [ |
|
88
|
|
|
self::TAG_INIT_PROPERTIES, |
|
89
|
|
|
]; |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|