Maybe it's only a typo here, but in relation definition in the Person
table you have "foreign: related" and it should be "foreign:
relatedId"


Or maybe the problem is that if you have M:N relation, you have schema
like this:

Table1
...
 relation:
  local: id1
  foreign: id2
  ...

Table2
...
 relation:
   local: id2
   foreign: id1

Table12
..

But you have only Table1 and the relation definition has always
local:id1 and never comes to the object where local is id2 - even if
it's a related object... maybe this can couse trables

In this case the Nest relations can be the solution.


I don't know, maybe my reflection is bad, or maybe nobody will
uderstand me :-)


On 3 bře, 20:56, axel at <[email protected]> wrote:
> I have a list of persons, and an m:n relation that relates one person
> with several other persons:
>
> Person:
>   columns:
>     id
>       type: integer(4)
>       primary: true
>     name: string(255)
>   relations:
>     # m:n Person2Person
>   Person:
>       class: Person
>       refClass: Person2Person
>       local: id
>       foreign: related
>       foreignAlias: contactPerson
>
> # m:n
> Person2Person:
>   columns:
>     id:
>       type: integer(4)
>       primary: true
>     relatedId:
>       type: integer(4)
>       primary: true
>   relations:
>     Person:
>       class: Person
>       local: relatedId
>       foreign: id
>     Person2:
>       class: Person
>       local: id
>       foreign: id
>
> in the PersonFrom class i use
> $this->embedRelation('RelatedPersons', "myRelatedPersonForm");
>
> everything works fine:
> symfony embedds 1 to n related person forms into the main person form
> also updates work fine
>
> the problem ist following:
> each time saving the form symfony commits a query like:
>
> update person2person set id = 100 where (id=200 and relatedId=100)
>
> (200 is the id of the main form and 100 the "relatedId")
>
> and of course this destroys the realation.
>
> any idea whats wrong and why this happens?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to