-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.php
115 lines (99 loc) · 2.25 KB
/
User.php
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
// src/AppBundle/Entity/User.php
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="Forder", mappedBy="user")
*/
private $forders;
/**
* @ORM\OneToMany(targetEntity="Item", mappedBy="user")
*/
private $items;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Group")
* @ORM\JoinTable(name="fos_user_user_group",
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}
* )
*/
protected $groups;
public function __construct()
{
parent::__construct();
// your own logic
}
/**
* Add item
*
* @param \AppBundle\Entity\Item $item
*
* @return User
*/
public function addItem(\AppBundle\Entity\Item $item)
{
$this->items[] = $item;
return $this;
}
/**
* Remove item
*
* @param \AppBundle\Entity\Item $item
*/
public function removeItem(\AppBundle\Entity\Item $item)
{
$this->items->removeElement($item);
}
/**
* Get items
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getItems()
{
return $this->items;
}
/**
* Add forder
*
* @param \AppBundle\Entity\Forder $forder
*
* @return User
*/
public function addForder(\AppBundle\Entity\Forder $forder)
{
$this->forders[] = $forder;
return $this;
}
/**
* Remove forder
*
* @param \AppBundle\Entity\Forder $forder
*/
public function removeForder(\AppBundle\Entity\Forder $forder)
{
$this->forders->removeElement($forder);
}
/**
* Get forders
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getForders()
{
return $this->forders;
}
}