johnf wrote:
> On Thursday 14 May 2009 09:29:44 am Paul McNett wrote:
>> create table people (id integer primary key,
>>                       name char);
>>
>> create table categories (id integer primary key,
>>                           name char);
>>
>> create table peoplecat (id integer primary key,
>>                          person_id,
>>                          category_id);
>>
>> The peoplecat table is the intermediary table. So I make a bizobj on the
>> peoplecat table, with SQL like:
>>
>> select peoplecat.id as id,
>>         peoplecat.person_id as person_id,
>>         peoplecat.category_id as category_id,
>>         people.name as person_name,
>>         categories.name as category_name
>>    left join people
>>      on people.id = peoplecat.person_id
>>    left join categories
>>      on categories.id = peoplecat.category_id
>>   group by peoplecat.id
>>
>> I then make 2 subclasses, PeopleForCategory and CategoriesForPerson.
>> PeopleForCategory has a LinkField of category_id, and CategoriesForPerson
>> has a LinkField of person_id.
>>
>> Your People bizobj adds CategoriesForPerson as a child, and your Categories
>> bizobj adds PeopleForCategory as a child.
> 
> Trying to get my head around this.  How do I create the subclasses???

Just like any other subclass.


> class PeopleForCategory(Bizobj_peoplecat,dabo.biz.dBizobj)
>    def afterInit(self):
>       self.LinkField = 'category_id'

No.

class BizPeopleCat(dabo.biz.dBizobj):
   def initProperties(self):
     ... create the sql, set the common props, etc.

class PeopleForCategory(BizPeopleCat):
   def initProperties(self):
     self.super()  # get the common props initialized
     self.LinkField = 'category_id'

HTH
Paul

_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4a0c595e.3020...@ulmcnett.com

Reply via email to