Re: Relationships
Re: Relationships
- Subject: Re: Relationships
- From: Awbrey Hughlett <email@hidden>
- Date: Thu, 2 Oct 2008 00:49:22 -0500
I am studying up. Thanks a bunch.
Awbrey
On Oct 1, 2008, at 11:46 PM, Chuck Hill wrote:
Some generic advice on "thinking in WebObjects".
On Oct 1, 2008, at 7:19 PM, Awbrey Hughlett wrote:
I have a component with an editing context linked to an entity
named Listing.
It is better to think of the EOEnterpriseObjects (usually just
called EOs), not entities, as being "in" the editing context.
Think of it like a sandbox. EOs in one sandbox can be related to
EOs in an other sandbox. They playground referee says so.
I have a WOPopUpButton that is populated from a entity named
Basic. The Basic entity has two attributes: basicID (primary key),
and basicType. basicID has a 'to many' relationship to the basicID
attribute of the entity Listing. When I save the changes to the
editing context, I want the basicID attribute in the selected
value from the WOPopUpButton to populate the basicID attribute of
the Listing entity.
As pretty much a hard and fast rule: "If you are thinking about
primary or foreign keys, you are doing it wrong". Those are
artifacts of the implementation. EOF manages those. Think about
objects and relationships between objects:
I have a WOPopUpButton that is populated from a entity named Basic.
The Basic entity has a name, basicType, that I shown in the
WOPopUpButton. A Listing object can have one Basic, and a Basic
can be used on many Listing objects. When I save the changes to
the editing context, I want the selected Basic object to become the
object in the basic() relationship of the Listing entity.
I can make it work if I make the basicID of both entities a class
property, but I know there has to be a better way using the
relationship I set up (given that I even did that correctly). Does
the method 'addObjectToBothSidesOfRelationship()' have anything to
do with that or am I just way off?
I think Guido pointed you in the right direction.
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden