Last active
April 8, 2019 01:38
-
-
Save JiNexus/8305b52027e622e51c56f3dc9a90c97f to your computer and use it in GitHub Desktop.
Doctrine Unidirectional Association Sample 1
This file contains hidden or 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 System\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Class User | |
* @package System\Entity | |
* @ORM\Entity() | |
* @ORM\Table(name="`user`") | |
*/ | |
class User | |
{ | |
/** | |
* @ORM\Id() | |
* @ORM\GeneratedValue(strategy="AUTO") | |
* @ORM\Column(name="id", type="bigint", options={"unsigned":true}) | |
*/ | |
private $id; | |
... | |
} |
This file contains hidden or 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 System\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Class UserInformation | |
* @package System\Entity | |
* @ORM\Entity() | |
* @ORM\Table(name="`user_information`") | |
*/ | |
class UserInformation | |
{ | |
/** | |
* @ORM\Id() | |
* @ORM\OneToOne(targetEntity="System\Entity\User") | |
* @ORM\JoinColumn(name="user_id", referencedColumnName="id") | |
*/ | |
private $user; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment