I'm new to CakePHP but experienced in OO and Databases. I'm trying to
figure out how to correctly model a lookup table in Cake.

One example from my app is the addresses table which has a state_id
which is a foreign key to the states table, field id.

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

What's the right way to do this?

Thanks,
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