Google Groups Home
Help | Sign in
Simple Inheritance
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all
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 13 May, 23:17
From: Alex <outroa...@gmail.com>
Date: Tue, 13 May 2008 15:17:32 -0700 (PDT)
Local: Tues 13 May 2008 23:17
Subject: Simple Inheritance
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


    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.
Jonathan Wage  
View profile
 More options 14 May, 15:51
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Wed, 14 May 2008 09:51:59 -0500
Local: Wed 14 May 2008 15:51
Subject: Re: [doctrine-user] Simple Inheritance

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

You want something like column aggregation inheritance it sounds like.

- Jon

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

    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.
Alex  
View profile
 More options 14 May, 17:20
From: Alex <outroa...@gmail.com>
Date: Wed, 14 May 2008 13:20:43 -0300
Local: Wed 14 May 2008 17:20
Subject: Re: [doctrine-user] Re: Simple Inheritance

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> wrote:


    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.
Jonathan Wage  
View profile
 More options 14 May, 17:43
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Wed, 14 May 2008 11:43:19 -0500
Local: Wed 14 May 2008 17:43
Subject: Re: [doctrine-user] Re: Simple Inheritance

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

- Jon

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

    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.
Alex  
View profile
 More options 14 May, 18:02
From: Alex <outroa...@gmail.com>
Date: Wed, 14 May 2008 14:02:31 -0300
Local: Wed 14 May 2008 18:02
Subject: Re: [doctrine-user] Re: Simple Inheritance

What would be an alternate solution?

- alex (from iphone)

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


    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.
Jonathan Wage  
View profile
 More options 14 May, 18:07
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Wed, 14 May 2008 12:07:25 -0500
Local: Wed 14 May 2008 18:07
Subject: Re: [doctrine-user] Re: Simple Inheritance

Just having a model with record_type and record_type_id, and you would set
the fields yourself?

- Jon

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

    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.
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.

--

- 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.
colnector (colnect.com)  
View profile
 More options 16 May, 17:29
From: "colnector (colnect.com)" <webmas...@colnect.com>
Date: Fri, 16 May 2008 09:29:27 -0700 (PDT)
Local: Fri 16 May 2008 17:29
Subject: Re: Simple Inheritance
You can look at the space wasted in percentages.
Also, every query will have to check the type field.

IMHO, column aggregation should be considered only if you have many
different inherited classes with small tables (up to a few thousands
of rows). In your case, concrete seems more convenient.

Cheers

2008/5/15 Alex:
    Well, you only get an additional 2 columns, one tinyint and one
integer, per row. Is that such a waste?

    For some reason duplicating the same table structure twice seems
icky, though it might not be.

    On Wed, May 14, 2008 at 8:40 PM, colnector wrote:

        Doesn't this create comment_id and item_id in the same votes
table?
        How is that better than using 'concrete inheritance' where
different
        tables are created?
        One should always consider what's going on behind the scenes
in the
        DBMS. It seems to me that using column aggregation as
presented here
        is wasteful of both time and space.

On May 14, 9:13 pm, Alex <outroa...@gmail.com> wrote:


    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.
Alex  
View profile
 More options 16 May, 17:36
From: Alex <outroa...@gmail.com>
Date: Fri, 16 May 2008 13:36:52 -0300
Local: Fri 16 May 2008 17:36
Subject: Re: [doctrine-user] Re: Simple Inheritance

My question is this: how tricky do migrations become if I have X concrete
inherited tables. Would altering the base class alter all below it?

On Fri, May 16, 2008 at 1:29 PM, colnector (colnect.com) <