Thanks for all the replies.

It seems like Cake's ActiveRecord implementation is great for what I'd
consider straight forward "CRUD" activities, but we have a couple
scnearios that don't seem to fit so well, in a currently existing app I
am thinking about porting to Cake:

1) The table name is not known in advance, effectively the application
code "tells" the data layer the desired table name to use. I'm not sure
if Cake's "$useTable" can be set "on the fly" or if it has to be part
of the class "static" definition.  I'm assuming it has to be defined in
advance, which would be a problem in this case

2) Creation of temporary tables - this seems to be a bit of a chicken
and egg problem: If I don't yet have a table, I can't have a model
representing that table, wihtout a model, I can't easily execute
database calls (afaik) to create the table.. I could have another model
pointing to some other unrelated pre-existing table, and then invoke a
method on that model to create the temp table but that feels like a bit
of a hack.

3) Some of our tables hold data that is formatted for use by a model
only - for example, the model performs calculations on the data and it
is only the result of these calculations that are useful in the domain.
In these cases, it would be nice to not expose all the other abilities
of ActiveRecord to the outside world for this model. It would be nice
to limit them to just using the API's that we have defined.  This is
kind of similar to the OO problem of composition - when you wrap up an
inner object in an outer object - sometimes you want the outer object
to just use the abilities of the inner object but not to publically
exposes the abilities of the inner object through the outer object

4) We have some current data routines that dynamically build pretty
optimized SQL statements, often involving nested selects and several
layers of joins. My problems with this are: 1) It hurts my brain to try
to figure out how to tell Cake to "do the same thing" through
associations, etc (I'm not every sure associations could cover what I'm
trying to do?) 2) the resulting combined data represents a conceptual
new entity in the domain that does not map to a single table in the
database, thus it feels wierd to arbitrarily pick "one" of those tabes
that the SQL accesses as the table this model represents, i.e., either
by matching the name of the model to this table or by setting it via
$useTable.

In this case I think ideally I'd like the ability to create a Model
named something like "FilteredRespondentGlobalTabulations", not have to
tie it to a particular table (or through assoications to other table),
be able to issue my own SQL through Cake's DboMysql (for example) and
not expose other data access methods through this model such as "save",
etc.

Thoughts?

Since I'm  new to Cake I'm still in that mode where you resist using
the tool for the more complicated tasks because it seems like you are
forcing a round peg in a square hole - probably some  of this will go
away with more experience and input from the group :-)

Thanks, Michael


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