Skip to content

Instantly share code, notes, and snippets.

@codecowboy
Created June 30, 2011 18:19
Show Gist options
  • Save codecowboy/1056837 to your computer and use it in GitHub Desktop.
Save codecowboy/1056837 to your computer and use it in GitHub Desktop.
User Entity Class
<?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