Created
April 17, 2017 14:38
-
-
Save jerson/12de6532c9486b9d791f8e71516884a5 to your computer and use it in GitHub Desktop.
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 | |
/** @Entity */ | |
class User | |
{ | |
// ... | |
/** | |
* Many User have Many Phonenumbers. | |
* @ManyToMany(targetEntity="Phonenumber") | |
* @JoinTable(name="users_phonenumbers", | |
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}, | |
* inverseJoinColumns={@JoinColumn(name="phonenumber_id", referencedColumnName="id", unique=true)} | |
* ) | |
*/ | |
private $phonenumbers; | |
public function __construct() | |
{ | |
$this->phonenumbers = new \Doctrine\Common\Collections\ArrayCollection(); | |
} | |
// ... | |
} | |
/** @Entity */ | |
class Phonenumber | |
{ | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment