It's easy to use SQL VIEWs (nothing to do with Cake "views") to rename 
fields. For example, suppose a pre-existing table called students had 
an auto-incrementing primary key called student_id, and another column 
called student_name. (Note that MYSQL 4 does not support views, but 
MySQL 5+ does.)

I would use a SQL VIEW to rename the fields by issuing the following 
query:

CREATE VIEW cake_students
AS SELECT
student_id AS id,
student_name AS name;

Then you can bake, if you wish, or manually construct a model, a 
controller and various cake views (no connection with SQL VIEWs), 
specifying the cake_students pseudo-table.

As far as I know, the whole Cake apparatus will treat the VIEW (pseudo-
table) cake_students just the same as it would a real table.

I don't know how to handle the creation of new records if the original 
primary key is not auto-incrementing, but I'm pretty confident there 
are ways to deal with that situation.

Ralph


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