Google Groups Home
Help | Sign in
Message from discussion Simple Inheritance
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Alex  
View profile
 More options 14 May, 19:13
From: Alex <outroa...@gmail.com>
Date: Wed, 14 May 2008 15:13:47 -0300
Local: Wed 14 May 2008 19:13
Subject: Re: [doctrine-user] Re: Simple Inheritance

How does this look?

Vote:
  tableName: votes
  actAs:
    Timestampable:
      created:
        name: created_at
        type: timestamp
        format:Y-m-d H:i:s
      updated:
        disabled: true
  columns:
    id:
      unsigned: 0
      primary: true
      notnull: true
      autoincrement: true
      type: integer
    user_id:
      unsigned: 0
      primary: false
      notnull: false
      autoincrement: false
      type: integer
    vote_type_id:
      unsigned: 0
      primary: false
      notnull: false
      autoincrement: false
      type: integer
  relations:
    sfGuardUser:
      local: user_id
      foreign: id
      type: one

VoteItem:
  inheritance:
    extends: Vote
    type: column_aggregation
    keyField: type
    keyValue: 1
  columns:
    item_id:
      type: integer

VoteComment:
  inheritance:
    extends: Vote
    type: column_aggregation
    keyField: type
    keyValue: 2
  columns:
    comment_id:
      type: integer

Advantage is that it maintains FK restrictions.

On Wed, May 14, 2008 at 2:07 PM, Jonathan Wage <jonw...@gmail.com> wrote:
> Just having a model with record_type and record_type_id, and you would set
> the fields yourself?

> - Jon

> On Wed, May 14, 2008 at 12:02 PM, Alex <outroa...@gmail.com> wrote:

>> What would be an alternate solution?

>> - alex (from iphone)

>> On 14-May-08, at 1:43 PM, "Jonathan Wage" <jonw...@gmail.com> wrote:

>> I think that column aggregation is the best solution right now.

>> - Jon

>> On Wed, May 14, 2008 at 11:20 AM, Alex < <outroa...@gmail.com>
>> outroa...@gmail.com> wrote:

>>> But with column aggregation I also have to define an additional column
>>> manually. It generates a TYPE column, but then I also need to create a
>>> TYPE_ID column so that the vote corresponds to the right item or topic.

>>> What's the ideal solution?

>>> - alex (from iphone)

>>> On 14-May-08, at 11:51 AM, "Jonathan Wage" < <jonw...@gmail.com>
>>> jonw...@gmail.com> wrote:

>>> Simple inheritance is one table with all columns on the parent.

>>> You want something like column aggregation inheritance it sounds like.

>>> - Jon

>>> On Tue, May 13, 2008 at 5:17 PM, Alex < <outroa...@gmail.com><outroa...@gmail.com>
>>> outroa...@gmail.com> wrote:

>>>> What exactly is simple inheritance? With what I have below, it doesn't
>>>> create any addiotional tables. How will I be able to query only votes
>>>> for Items?

>>>> Thanks!

>>>> Vote:
>>>>  tableName: votes
>>>>  actAs:
>>>>    Timestampable:
>>>>      created:
>>>>        name: created_at
>>>>        type: timestamp
>>>>        format:Y-m-d H:i:s
>>>>      updated:
>>>>        disabled: true
>>>>  columns:
>>>>    id:
>>>>      unsigned: 0
>>>>      primary: true
>>>>      notnull: true
>>>>      autoincrement: true
>>>>      type: integer
>>>>    user_id:
>>>>      unsigned: 0
>>>>      primary: false
>>>>      notnull: false
>>>>      autoincrement: false
>>>>      type: integer

>>>> VoteItem:
>>>>  inheritance:
>>>>    extends: Vote
>>>>    type: simple

>>>> VoteComment:
>>>>  inheritance:
>>>>    extends: Vote
>>>>    type: simple

>>> --
>>> Jonathan Wage
>>> <http://www.jwage.com> <http://www.jwage.com>http://www.jwage.com
>>>  <http://www.centresource.com> <http://www.centresource.com>
>>> http://www.centresource.com

>> --
>> Jonathan Wage
>> <http://www.jwage.com>http://www.jwage.com
>> <http://www.centresource.com>http://www.centresource.com

> --
> Jonathan Wage
> http://www.jwage.com
> http://www.centresource.com

--

- Alex


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google