John David Anderson (_psychic_) wrote:
> >
> > So in state_php I can write
> >
> >     var $hasMany = array('Address' =>
> >                 array('className'    => 'Address',
> >                       'conditions'   => '',
> >                       'order'        => '',
> >                       'dependent'    =>  true,
> >                       'foreignKey'   => 'state_id'
> >                 )
> >           );
> >
> > But this just doesn't seem right. Why should State know anything about
> > Address?
>
> Because you've just defined it. It doesn't have to be that way: you
> can define only the Address belongsTo State relationship if you choose.

That makes it a lot cleaner. It makes sense for an Address to know
about a State, so putting the $belongsTo in Address is better.

>
> > A lookup table just isn't the same as an actual object where I
> > store and update data. It just an enum that's pulled out for
> > maintainability and clarity. Plus, State may be used in multiple
> > locations and it doesn't make sense to update the State model
> > because I
> > want to use it somewhere else.
>
> Not sure what you're after here - are you asking a question? Maybe
> I'm just not understanding.

Just getting a handle on how the logical object model maps to the code
model. Since I don't have to put code in State to make the relationship
work, that clears it up.

> 
> -- J

Thanks for clearing that up!

-- Windflower


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to