I am working on site where I will have a many-to-many relationship between 
drills and tags.

The concept being that when I user creates a new drill entity, they can 
define multiple tags that should be associated with it. 
As is in probably the case in most systems, I only want to create a new tag 
entry if the text/name of the tag is unique, otherwise I want the 
association to point to the previously existing tag. 

I know that in my controller (I am using symfony2) I can explicitly query 
for tags and check for uniqueness, but I am hoping that their is a way in 
doctrine to do it. 

It doesn't matter to me if this is a many-to-many or a 
one-to-many/many-to-one where I have to explicitly create the entity for 
the join table. 

Goals
1. Persist of drill should cascade persist of tag.
2. Persist of tag should only happen if unique.

I have read about the unique entity stuff, and how you can check that via 
the form->isValid call, but it wasn't clear to me how doctrine would know 
that the tag (created via a JS tool and is really just a string of text) 
would be connected to entries in the DB as I am not currently querying for 
tags (via any soft of auto-complete logic in the JS).

Does someone have a good example of how to do this? My guess is that this 
is a fairly non-unique situation, but I can't find good documentation on 
it. 

Thanks


-- 
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/d/optout.

Reply via email to