Skip to content

Instantly share code, notes, and snippets.

@codecowboy
Created July 12, 2011 20:13
Show Gist options
  • Save codecowboy/1078873 to your computer and use it in GitHub Desktop.
Save codecowboy/1078873 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="gymloop_users")
*/
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;
/**
*
* @ORM\OneToMany(targetEntity="Gymloop\DiaryBundle\Entity\TrainingSession",mappedBy="user", cascade={"persist"})
*/
protected $training_sessions;
/**
* @ORM\Column(type="string", length="100",nullable="true")
*/
protected $first_name;
/**
* @ORM\Column(type="string", length="100", nullable="true")
*/
protected $last_name;
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;
$programmes->setUser($this);
}
/**
* Get programmes
*
* @return Doctrine\Common\Collections\Collection $programmes
*/
public function getProgrammes()
{
return $this->programmes;
}
/**
* Add training_sessions
*
* @param Gymloop\DiaryBundle\Entity\TrainingSession $trainingSessions
*/
public function addTrainingSessions(\Gymloop\DiaryBundle\Entity\TrainingSession $trainingSessions)
{
$this->training_sessions[] = $trainingSessions;
}
/**
* Get training_sessions
*
* @return Doctrine\Common\Collections\Collection
*/
public function getTrainingSessions()
{
return $this->training_sessions;
}
/**
* Set first_name
*
* @param string $firstName
*/
public function setFirstName($firstName)
{
$this->first_name = $firstName;
}
/**
* Get first_name
*
* @return string
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* Set last_name
*
* @param string $lastName
*/
public function setLastName($lastName)
{
$this->last_name = $lastName;
}
/**
* Get last_name
*
* @return string
*/
public function getLastName()
{
return $this->last_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment