Hi,
2011/2/25 Alex Pilon <[email protected]>:
> 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 [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
>
It's simple
Comment:
actAs:
Signable:
created:
name: created_by
type: integer
updated:
name: updated_by
type: integer
Timestampable:
columns:
user_id: { type: integer(5), notnull: true }
microblog_id: { type: integer(5) }
blog_id: { type: integer(5) }
gallery_id: { type: integer(5) }
photo_id: { type: integer(5) }
favourite_id: { type: integer(5) }
game_id: { type: integer(5) }
content: { type: string(65536), notnull: true }
publication: { type: boolean, notnull: true, default: 1 }
moderated: { type: boolean, notnull: true, default: 0 }
visibility: { type: integer(1), notnull: true, default: 0 }
indexes:
comment_myindex:
fields: [user_id, microblog_id, blog_id, gallery_id, photo_id,
favourite_id, game_id, publication, moderated, created_at, updated_at]
relations:
User:
class: sfGuardUser
local: user_id
foreign: id
onDelete: CASCADE
Microblog:
class: Microblog
local: microblog_id
foreign: id
onDelete: CASCADE
Blog:
class: Blog
local: blog_id
foreign: id
onDelete: CASCADE
Gallery:
class: Gallery
local: gallery_id
foreign: id
onDelete: CASCADE
Photo:
class: Photo
local: photo_id
foreign: id
onDelete: CASCADE
Favourite:
class: Favourite
local: favourite_id
foreign: id
onDelete: CASCADE
Game:
class: Game
local: game_id
foreign: id
onDelete: CASCADE
I'm using fk's, but you can use just table_name and one fk for object id.
--
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 [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