Last active
August 29, 2015 13:55
-
-
Save dcsg/8698657 to your computer and use it in GitHub Desktop.
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 | |
// ... | |
class File | |
{ | |
/** | |
* @Id | |
* @GeneratedValue | |
* @Column(type="bigint") | |
* | |
* @var int | |
*/ | |
private $id; | |
/** | |
* @ManyToMany(targetEntity="Tag") | |
* @JoinTable(name="file_tags", | |
* joinColumns={@JoinColumn(name="file_id", referencedColumnName="id")}, | |
* inverseJoinColumns={@JoinColumn(name="tag_id", referencedColumnName="id")} | |
* ) | |
* | |
* @var Collection | |
*/ | |
private $tags; | |
//.. | |
} |
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 | |
// ... | |
Class MyController | |
{ | |
public function myAction() | |
{ | |
// ... | |
$this->getDoctrine() | |
->getRepository('MyBundle:File') | |
->findByTags($tag); | |
// Throws: Undefined index: joinColumns in vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1495 | |
} | |
} |
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 | |
// ... | |
class Tag | |
{ | |
/** | |
* @Id | |
* @GeneratedValue | |
* @Column(type="bigint") | |
* | |
* @var int | |
*/ | |
private $id; | |
//.. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment