W dniu 26 lutego 2011 16:36 użytkownik Grzegorz Śliwiński
<fi...@fizyk.net.pl> napisał:
> Michal's idea is one way, although personally wouldn't add that many
> fk's into Comment model. Each new model that will get commented, will
> result in modifying Comment table. If it'll grow up, ALTER TABLE might
> take long time.
> Second idea is to create association tables for each commented model
> (i'd prefer that), - Each new model will result ony in new association
> table, without the need to alter comment table
> Third idea is used in vjCommentPlugin: 
> http://www.symfony-project.org/plugins/vjCommentPlugin
> There are no foreign keys, instead there is field which indicates
> commented object's model, and it's id.

That I had in mind, just expressed it the wrong way
"but you can use just table_name and one fk for object id."

Seems to me that this is a good way. You just have to remember to
delete comments when you remove related content.

>
> On 25 Lut, 16:51, Alex Pilon <alex.pi...@gmail.com> wrote:
>> Hello Everyone,
>>
>> I have a schema in which I have several entities, lets call them Shows,
>> Broadcasters and Pitches.
>>
>> A Show is essentially pitched to a Broadcaster which creates the Pitch which
>> is an entity that sits between Show and Broadcaster and creates a many to
>> many relationship.
>>
>> This is all fine and good, however there is a Note model which is meant to
>> be attached to Show and Broadcaster (and potentially Pitch in the future).
>>
>> It seems to me that this sort of multi use comments table won't work quite
>> right unless Show and Broadcaster have a common primary key, as there
>> wouldn't be anyway to guarentee unique ids between the Show and Broadcaster
>> and therefore Note would have an invalid foreign key.
>>
>> The idea I had to solve this was to create an entity table in which the
>> other Models inherit from, but the types of inheritance don't seem to solve
>> this problem, as simple puts everything in one table, which is rather
>> undesirable, and concrete doesn't seem to allow shared ids with a base
>> table.
>>
>> Anyone ever have a similar set up?
>>
>> --
>> Alex Pilon
>> (613) 608-1480
>
> --
> 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 symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Best regards,
Michal

http://eventhorizon.pl/

-- 
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 symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to