Created
June 30, 2011 18:19
-
-
Save codecowboy/1056837 to your computer and use it in GitHub Desktop.
User Entity Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Gymloop\CoreBundle\Entity; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use FOS\UserBundle\Entity\User as BaseUser; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="fos_user") | |
*/ | |
class User extends BaseUser | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\generatedValue(strategy="AUTO") | |
*/ | |
protected $id; | |
/** | |
* | |
* @ORM\OneToMany(targetEntity="Programme",mappedBy="user", cascade={"persist"}) | |
*/ | |
protected $programmes; | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->programmes = new ArrayCollection(); | |
} | |
/** | |
* Get id | |
* | |
* @return integer $id | |
*/ | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* Add programmes | |
* | |
* @param Gymloop\CoreBundle\Entity\Programme $programmes | |
*/ | |
public function addProgrammes(\Gymloop\CoreBundle\Entity\Programme $programmes) | |
{ | |
$this->programmes[] = $programmes; | |
} | |
/** | |
* Get programmes | |
* | |
* @return Doctrine\Common\Collections\Collection $programmes | |
*/ | |
public function getProgrammes() | |
{ | |
return $this->programmes; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment