Created
October 10, 2014 15:57
-
-
Save ajaypatelbardoli/2f0c81cbdf3b0d136785 to your computer and use it in GitHub Desktop.
UserEntity
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 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