M2M relation is normal and nature, why try to avoid that?

On Monday, October 29, 2012 4:55:35 AM UTC+8, Marco Pivetta wrote:
>
> Heya,
>
> if you have additional information, you do not have a M2M relation. What 
> you have is actually an entity with a ManyToOne relation to each of the 
> sides of what you previously defined as ManyToMany and then your additional 
> fields.
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>
>
>
> On 28 October 2012 17:37, Antonino Caccamo <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>> I'm having the same problem.
>> Did you find a solution?
>>
>> Thanks
>> Antonino
>>
>>
>> On Thursday, March 8, 2012 6:23:12 PM UTC+1, Heitor wrote:
>>>
>>> So I have a Families table, a Units table and a Families_Units table. On 
>>> Families_Units, i have:
>>>
>>> - a family_id field as a foreign key to Families.id,
>>> - a unit_id field as a foreign key to Units.id,
>>> - a information field that is a text field with the information of that 
>>> family on that unit.
>>>
>>> I also have a restriction that says that each set of (family_di, 
>>> unit_id) must be unique. So I can't have two registries with both ids 
>>> repeated.
>>>
>>> This is where I got so far:
>>>
>>> ------------------------------**------------------------------**------
>>> Jungle\AsocialTesteBundle\**Entity\Families:
>>>     type: entity
>>>     table: families
>>>     fields:
>>>         id:
>>>             id: true
>>>             type: integer
>>>             nullable: false
>>>             column: id
>>>             generator:
>>>                 strategy: IDENTITY
>>>         ...
>>>              extra fields...
>>>         ...
>>>     manyToMany:
>>>         unit_id:
>>>             targetEntity: Families
>>>             joinTable:
>>>                 name: families_units
>>>                 joinColumns:
>>>                     family_id:
>>>                         referencedColumnName: id
>>>                         unique: true
>>>                 inverseJoinColumns:
>>>                     unit_id:
>>>                         referencedColumnName: id
>>>                         unique: true
>>> ------------------------------**------------------------------**------
>>> Jungle\AsocialTesteBundle\**Entity\FamiliesUnits:
>>>     type: entity
>>>     table: families_units
>>>     fields:
>>>         id:
>>>             id: true
>>>             type: integer
>>>             nullable: false
>>>             column: id
>>>             generator:
>>>                 strategy: AUTO
>>>         information:
>>>             type: string
>>>             length: 12
>>>             nullable: false
>>>             column: information
>>> ------------------------------**------------------------------**------
>>>
>>> Then when I try to update the schema:
>>>
>>> >php app/console doctrine:schema:update
>>>
>>>
>>>
>>>   [Doctrine\DBAL\Schema\**SchemaException]
>>>   The table with name 'families_units' already exists.
>>>
>>> I understand that removing the YAML routing of families_units removes 
>>> the error, but where do I put the information field?
>>>
>>> Thanks in advance,
>>>
>>>  -- 
>> 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 developers" group.
>> To post to this group, send email to [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-devs?hl=en
>>
>
>

-- 
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 developers" 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-devs?hl=en

Reply via email to