Hi Antonino,

Yes, I ended up doing as the other guys are saying, splitting the 
relationship in two manyToOne relationships in a new Entity. In the new 
entity, I put the extra fields I needed. Kinda clunky, since I have to call 
the relationship as $entity->getMiddleEntity()->getOtherEntityId(), but it 
works.


On Sunday, October 28, 2012 2:37:00 PM UTC-2, Antonino Caccamo 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]
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