Hey there,

no, the way I mean is this:

bill:
  id:

shop_items:
  id:
  name:
  *other common attributes*

attributes:
  id:
  name:
  type: (this can be things like "text", "select many", "select one"
etc..)

attribute_content:
  attribute_id:
  shop_item_id:
  value:

shop_items_to_attribute_content:
  shop_item_id:
  attribute_content_id:


Do you see how you can now build all sorts of shop items with all
sorts of attributes?
Like books, that have author, ISBN, title, etc.., and tools, that have
weight, dimensions, etc..

This is a very flexible system that allows you to grow into any
direction. It is just a little unusual when you're used to thinking on
a database level.

Does that make sense to you?
Daniel


On Oct 31, 1:13 am, Thibault Jouannic <[EMAIL PROTECTED]> wrote:
> Hi Richtermeister, thank you for your reply.
>
> I'm not sure to understand, how you would build that in Symfony. As
> far as I understand it, that would be something like :
>
> bill:
>   id:
>
> shop_items:
>   id:
>   book_id:
>   tool_id:
>   ...
>   bill_id:
>
> book:
>   id
>
> tool:
>   id:
>
> Am I right ?
>
> Regards,
> Thibault
>
> On Oct 30, 10:15 pm, Richtermeister <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
>
> > I think a "good" solution for your problem needs to be more flexible.
> > For example, you have separate tables for tools and books.
> > What is often done is have a table for generic items "ShopItems" that
> > stores the type of item (tool, book, etc.. now it's dynamic) and link
> > those to an attribute table that holds the attributes that you
> > originally stored in the table fields.
> > This way you're building your items dynamically, and you can link them
> > directly to the bill table. And you can add totally different items in
> > the future.
> > At least his is how many online store systems work.
>
> > Daniel
>
> > On Oct 30, 6:11 am, Thibault Jouannic <[EMAIL PROTECTED]> wrote:
>
> > > Hello there,
>
> > > I need to link two tables together, however the linked table type is
> > > not fixed.
>
> > > Exemple :
>
> > > I've got a "bill" table, with fields like "price", "paid_date",
> > > "customer_id", etc.
>
> > > From that table, I want a foreign key to link to the charged object,
> > > so I can use something like :
>
> > > $bill->getChargedObject()
>
> > > However, different kind of objects can be charged. It could be a tool,
> > > or a book, or anything else. Each of these have very specific fields.
> > >  (note : this is just an example, the real problem is more complex)
>
> > > So I've created corresponding tables (tool, book), and I'v managed the
> > > link like that :
>
> > > propel:
> > >   bill:
> > >     paiment_date: date
> > >     charged_object_class: varchar(255)
> > >     charged_object_id: integer
>
> > > The solution works pretty well, however, I've lost the power of
> > > foreign keys, and the ability to use names in fixtures. Has anyone
> > > already experienced this kind of solution ? I would be glad to here
> > > some differents opinions here.
>
> > > Best regards,
> > > Thibault
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to