Skip to content

Instantly share code, notes, and snippets.

@dcsg
Last active August 29, 2015 13:55
Show Gist options
  • Select an option

  • Save dcsg/8698657 to your computer and use it in GitHub Desktop.

Select an option

Save dcsg/8698657 to your computer and use it in GitHub Desktop.

Revisions

  1. dcsg revised this gist Jan 29, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion MyController.php
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,10 @@
    {
    public function myAction()
    {
    // ...
    $this->getDoctrine()
    ->getRepository('MyBundle:File')
    ->findByTags($id);
    ->findByTags($tag);

    // Throws: Undefined index: joinColumns in vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1495
    }
  2. dcsg revised this gist Jan 29, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion MyController.php
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ public function myAction()
    {
    $this->getDoctrine()
    ->getRepository('MyBundle:File')
    ->findByTag($id);
    ->findByTags($id);

    // Throws: Undefined index: joinColumns in vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1495
    }
  3. dcsg created this gist Jan 29, 2014.
    28 changes: 28 additions & 0 deletions File.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    <?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;

    //..
    }
    15 changes: 15 additions & 0 deletions MyController.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php

    // ...

    Class MyController
    {
    public function myAction()
    {
    $this->getDoctrine()
    ->getRepository('MyBundle:File')
    ->findByTag($id);

    // Throws: Undefined index: joinColumns in vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1495
    }
    }
    16 changes: 16 additions & 0 deletions Tag.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    <?php

    // ...
    class Tag
    {

    /**
    * @Id
    * @GeneratedValue
    * @Column(type="bigint")
    *
    * @var int
    */
    private $id;
    //..
    }