On 04/09/07, Jason <[EMAIL PROTECTED]> wrote:
>
> 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.

Hi!

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


Just set up the models as you would normally, but don't create
controllers or views for them.  This will make sure that no one can
edit or delete from your app as there will be no pages or functions to
do so.
You can reference the tables back from whatever controller you want by
using the $uses variable.

Try to just bake the application but leave out the controller and view
for each of these models, as you wont be using them.

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

In this case you can use the controller for each model, but don't
create the usual CRUD functions, only create what you need to access
the database with.

I hope this helped a bit.

Mike.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to