~tsep-dev/tsep/tsep2

« back to all changes in this revision

Viewing changes to src/TSEP/Packagist/WebBundle/Entity/User.php

  • Committer: xaav
  • Date: 2011-10-01 18:10:50 UTC
  • Revision ID: git-v1:e1357bf55d2d528a58efeead2a02193370e17823
CS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
namespace Packagist\WebBundle\Entity;
4
 
 
5
 
use FOS\UserBundle\Entity\User as BaseUser;
6
 
use Doctrine\ORM\Mapping as ORM;
7
 
use Doctrine\Common\Collections\ArrayCollection;
8
 
 
9
 
/**
10
 
 * @ORM\Entity
11
 
 * @ORM\Table(name="fos_user")
12
 
 */
13
 
class User extends BaseUser
14
 
{
15
 
    /**
16
 
     * @ORM\Id
17
 
     * @ORM\Column(type="integer")
18
 
     * @ORM\generatedValue(strategy="AUTO")
19
 
     */
20
 
    protected $id;
21
 
 
22
 
    /**
23
 
     * @ORM\ManyToMany(targetEntity="Package", mappedBy="maintainers")
24
 
     */
25
 
    private $packages;
26
 
 
27
 
    /**
28
 
     * @ORM\OneToMany(targetEntity="Packagist\WebBundle\Entity\Author", mappedBy="owner")
29
 
     */
30
 
    private $authors;
31
 
 
32
 
    public function __construct()
33
 
    {
34
 
        $this->packages = new ArrayCollection();
35
 
        $this->authors = new ArrayCollection();
36
 
        parent::__construct();
37
 
    }
38
 
 
39
 
    public function toArray()
40
 
    {
41
 
        return array(
42
 
            'name' => $this->username,
43
 
            'email' => $this->email,
44
 
        );
45
 
    }
46
 
 
47
 
    /**
48
 
     * Add packages
49
 
     *
50
 
     * @param Packagist\WebBundle\Entity\Package $packages
51
 
     */
52
 
    public function addPackages(Package $packages)
53
 
    {
54
 
        $this->packages[] = $packages;
55
 
    }
56
 
 
57
 
    /**
58
 
     * Get packages
59
 
     *
60
 
     * @return Doctrine\Common\Collections\Collection $packages
61
 
     */
62
 
    public function getPackages()
63
 
    {
64
 
        return $this->packages;
65
 
    }
66
 
 
67
 
    /**
68
 
     * Add authors
69
 
     *
70
 
     * @param Packagist\WebBundle\Entity\Author $authors
71
 
     */
72
 
    public function addAuthors(\Packagist\WebBundle\Entity\Author $authors)
73
 
    {
74
 
        $this->authors[] = $authors;
75
 
    }
76
 
 
77
 
    /**
78
 
     * Get authors
79
 
     *
80
 
     * @return Doctrine\Common\Collections\Collection
81
 
     */
82
 
    public function getAuthors()
83
 
    {
84
 
        return $this->authors;
85
 
    }
86
 
}
 
 
b'\\ No newline at end of file'