Skip to content

Instantly share code, notes, and snippets.

@codecowboy
Created September 1, 2011 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecowboy/1185840 to your computer and use it in GitHub Desktop.
Save codecowboy/1185840 to your computer and use it in GitHub Desktop.
User Entity
<?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")
* @ORM\Entity(repositoryClass="Gymloop\CoreBundle\Entity\UserRepository")
*/
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="Motivation",mappedBy="user", cascade={"persist"})
*/
protected $motivation;
/**
*
* @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;
}
/**
* Add motivation
*
* @param Gymloop\CoreBundle\Entity\Motivation $motivation
*/
public function addMotivation(\Gymloop\CoreBundle\Entity\Motivation $motivation)
{
$this->motivation[] = $motivation;
}
/**
* Get motivation
*
* @return Doctrine\Common\Collections\Collection
*/
public function getMotivation()
{
return $this->motivation;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment