Hi Jess,

Yes, when you have a bidirectional association, the owning sides needs an 
`inversedBy` and the inversed side needs a `mappedBy`.


Tip: use this command to have Doctrine report what it would do in order to sync 
the database:

    $ doctrine orm:schema-tool:update --dump-sql

Most of the time you'll want to perform these changes in the database, but 
sometimes you see something that isn't correct in the mappings (you forgot to 
add/remove a `nullable=FALSE` on some property for example).

-- 
Jasper N. Brouwer
(@jaspernbrouwer)


On 13 Feb 2014, at 11:15, Jess Rowbottom <[email protected]> wrote:

> Fixed it, thanks for the pointers!
> 
> The ManyToMany in Photo needed an inversedBy :
> 
>     /**
>      * @ORM\ManyToMany(targetEntity="Tag",inversedBy="photos")
>      * @ORM\JoinTable(name="tag_photo_link",
>      *      joinColumns={@ORM\JoinColumn(name="tm_photoid", 
> referencedColumnName="ph_id")},
>      *      inverseJoinColumns={@ORM\JoinColumn(name="tm_keywordid", 
> referencedColumnName="ta_id")}
>      *      )
>      **/
>     private $tags;
> 
> and Tag was looking at the column name not the attribute within the Photo 
> entity:
> 
>     /**
>      * @ORM\ManyToMany(targetEntity="Hotfox\Entity\Photo", mappedBy="tags")
>      **/
>     private $photos;
> 
> 
> Works like a dream now. Thankyou so much!
> 
> Cheers
> 
> Jess

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to