-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMonsterReward.php
More file actions
85 lines (75 loc) · 1.78 KB
/
Copy pathMonsterReward.php
File metadata and controls
85 lines (75 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace App\Entity;
use DaybreakStudios\Utility\DoctrineEntities\EntityInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Selectable;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity()
* @ORM\Table(
* name="monster_rewards",
* uniqueConstraints={
* @ORM\UniqueConstraint(columns={"monster_id", "item_id"})
* }
* )
*
* @package App\Entity
*/
class MonsterReward implements EntityInterface {
use EntityTrait;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Monster", inversedBy="rewards")
* @ORM\JoinColumn(nullable=false)
*
* @var Monster
*/
private $monster;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Item")
* @ORM\JoinColumn(nullable=false)
*
* @var Item
*/
private $item;
/**
* @Assert\Valid()
* @Assert\Count(min=1)
*
* @ORM\ManyToMany(targetEntity="App\Entity\RewardCondition", cascade={"all"}, orphanRemoval=true)
* @ORM\JoinTable(name="monster_reward_conditions")
*
* @var Collection|Selectable|RewardCondition[]
*/
private $conditions;
/**
* MonsterReward constructor.
*
* @param Monster $monster
* @param Item $item
*/
public function __construct(Monster $monster, Item $item) {
$this->monster = $monster;
$this->item = $item;
$this->conditions = new ArrayCollection();
}
/**
* @return Monster
*/
public function getMonster(): Monster {
return $this->monster;
}
/**
* @return Item
*/
public function getItem(): Item {
return $this->item;
}
/**
* @return RewardCondition[]|Collection|Selectable
*/
public function getConditions() {
return $this->conditions;
}
}