Completed
Push — master ( cc14f9...f9bab8 )
by Michael
02:32
created

User   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setInvitation() 0 4 1
A getInvitation() 0 4 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use FOS\UserBundle\Model\User as BaseUser;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Component\Validator\Constraints as Assert;
8
use AppBundle\Entity\Invitation;
9
10
/**
11
 * @ORM\Entity
12
 * @ORM\Table(name="fos_user")
13
 */
14
class User extends BaseUser
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue(strategy="AUTO")
20
     */
21
    protected $id;
22
23
    /**
24
     * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Group")
25
     * @ORM\JoinTable(name="fos_user_user_group",
26
     *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
27
     *      inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}
28
     * )
29
     */
30
    protected $groups;
31
32
    /**
33
     * @ORM\OneToOne(targetEntity="Invitation")
34
     * @ORM\JoinColumn(referencedColumnName="code")
35
     * @Assert\NotNull(message="Your invitation is wrong", groups={"Registration"})
36
     */
37
    protected $invitation;
38
39
    public function __construct()
40
    {
41
        parent::__construct();
42
    }
43
44
    public function setInvitation(Invitation $invitation)
45
    {
46
        $this->invitation = $invitation;
47
    }
48
49
    public function getInvitation()
50
    {
51
        return $this->invitation;
52
    }
53
}
54