Skip to content

Instantly share code, notes, and snippets.

@dcsg
Last active August 29, 2015 13:55
Show Gist options
  • Save dcsg/8698657 to your computer and use it in GitHub Desktop.
Save dcsg/8698657 to your computer and use it in GitHub Desktop.
<?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;
//..
}
<?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
}
}
<?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