> Probably not, because CakePHP is ADO. If you run your view query in an
> mysql client it will give  you the same field name as cake was giving
> you, after you gave aliases to every field being returned by your view
> cake is now placing it properly on the Model's array.

No, it isn't the aliases.  It's the function calls.  Here is the view
creation script using just the aliases:

CREATE VIEW users_profile_view AS
SELECT
  users.id AS id,
  users.username AS username,
  DATE( users.last_login ) as last_login,
  users.city AS city,
  users.state AS state,
  users.country AS country,
  users.comments AS comments,
  users.theme AS theme,
  SUM( collections.owned ) as pieces_in_inventory
FROM users
LEFT OUTER JOIN collections ON collections.user_id = users.id
GROUP BY users.id;

Here is the query being run by CakePHP:

SELECT `UsersProfileView`.`id`, `UsersProfileView`.`username`,
`UsersProfileView`.`last_login`, `UsersProfileView`.`city`,
`UsersProfileView`.`state`, `UsersProfileView`.`country`,
`UsersProfileView`.`comments`, `UsersProfileView`.`theme`,
`UsersProfileView`.`pieces_in_inventory` FROM `users_profile_view` AS
`UsersProfileView` WHERE 1 = 1 LIMIT 1

Here is what is being returned on line 555 of dbo_source.php:

Array
(
    [0] => Array
        (
            [users] => Array
                (
                    [id] => bob
                    [username] => bob
                    [city] => bob
                    [state] => bob
                    [country] => bob
                    [comments] => bob
                    [theme] => bob
                )

            [UsersProfileView] => Array
                (
                    [last_login] => 2002-10-18
                    [pieces_in_inventory] => 1
                )

        )
)

As you can see, only those fields that used a function call were
actually placed under the 'UsersProfileView' key.  The aliases didn't
seem to matter one jot to how CakePHP processed the query and/or data.
As soon as I add the function calls back into my database view
creation, it works again as described in my previous post.

In my client, whether it's the GUI app developed by MySQL or the
command line, whenever I query (or DESCribe) the view, it all looks
fine.  Somehow, for some reason, CakePHP is getting, and using
(erroneously in my opinion) the table names from the underlying view
query and not from the view itself.

thnx,
Christoph


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