This is my first post to this group, so I'd like to say hello
first. :) This post seems long, but the question is pretty simple -
not sure about the answer.
My question revolves around models. I have 5 tables that represent
geographic information. I want to use this to do radius searches among
other things.
My problem is I'm not sure how to represent this data within Cake. My
tables are setup as follows:
zip_codes
zip_code
latitude
longitude
dst (daylights saving - boolean)
timezone
cities
id
state_id
name
cities_zip_codes
city_id
zip_code
states
id
country_id
name
countries
id
name
I would like to be able to access this data through one object that is
locked down. There will be no reason for my application to ever add or
delete from these tables. I was hoping that I could create something
sort of like a Component is to a controller or a helper is to a view
for a model. Nothing like this seems to exist, however.
If I were to use Cake's built in ORM, it would be as follows:
zip_code has and belongs to many city
city has and belongs to many zip_code, city belongs to state
state has many city, state belongs to country
country has many state
Using it this way, which model would I then use? How do I keep coders
from using these models to edit the tables? Isn't this a LOT of
queries everytime I instantiate one of these models? And scaffolding
totally blows up (spikes my Apache process to 100% and doesn't let go)
when I attempt to use this type of ORM.
I need a way to have an object talk to these tables and provide me
with the few functions I need (distance between two zip codes, radius
searching, etc.) without providing full ORM. I also need to be able to
access this object from within any controller and it needs to use the
DB connection that Cake sets up.
What is the best way to accomplish this while staying within the
constraints and guidelines of the Cake system?
Any suggestions are GREATLY appreciated!
Thanks,
Jason
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---