All pastes #20055 Raw Edit

Mine

public text v1 · immutable
#20055 ·published 2005-08-15 11:28 UTC
rendered paste body
descriptorForInsider: aDescriptor 

	| table |
	table := self insidersTable.
	aDescriptor table: table.
	(aDescriptor newMapping: DirectMapping) from: #id to: (table fieldNamed: 'id').
	(aDescriptor newMapping: DirectMapping) from: #name to: (table fieldNamed: 'name').
	(aDescriptor newMapping: DirectMapping) from: #style to: (table fieldNamed: 'style').
	(aDescriptor newMapping: OneToManyMapping) 
		attributeName: #trades; 
		orderBy: #date;
		join: (Join from: (table fieldNamed: 'id') to: (self insiderTradesTable fieldNamed: 'insider_id')).

---

classModelForInsider: aClassModel

	aClassModel 
		newAttributeNamed: #id;
		newAttributeNamed: #name;
		newAttributeNamed: #style;
		newAttributeNamed: #trades collectionOf: InsiderTrade