Skip to content

Instantly share code, notes, and snippets.

@ajaypatelbardoli
Created October 10, 2014 15:57
Show Gist options
  • Save ajaypatelbardoli/2f0c81cbdf3b0d136785 to your computer and use it in GitHub Desktop.
Save ajaypatelbardoli/2f0c81cbdf3b0d136785 to your computer and use it in GitHub Desktop.
UserEntity
<?php
namespace XXXX\Bundle\UserBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* Class User
* @ORM\Entity
* @ORM\Table(name="users")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToOne(targetEntity="XXXX\Bundle\UserBundle\Entity\Profile", mappedBy="userId", cascade={"persist", "merge"})
**/
private $profile;
public function __construct()
{
parent::__construct();
// your own logic
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set profile
*
* @param \XXXX\Bundle\UserBundle\Entity\Profile $profile
* @return User
*/
public function setProfile(\XXXX\Bundle\UserBundle\Entity\Profile $profile = null)
{
$this->profile = $profile;
return $this;
}
/**
* Get profile
*
* @return \XXXX\Bundle\UserBundle\Entity\Profile
*/
public function getProfile()
{
return $this->profile;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment