Thanks grigri. That explains it. Then I will either live with them belonging to table 0 or try to do things another way.
/Maritn On Jun 30, 1:15 pm, grigri <[EMAIL PROTECTED]> wrote: > As-is, this is not supported in CakePHP. Well, not for MySQL. > > Divvying up the resultset into chunks (as you would expect [and works > fine] for joins) is not as easy as it sounds, and depends greatly on > the underlying database. MySQL supports the concept of the > "originating table" for each returned field, so it's easy. Except when > it's a dynamic field; which does not have an originating table, so it > goes into spot '0' (see the `resultSet` function in cake/libs/model/ > datasources/dbo/dbo_mysql.php). > > For databases* which do not support the "originating table", cake > simulates it by pre-pending the required table name to each field, > plus a double-underscore (see the resultSet function in > dbo_postgres.php). So for postgres, you can do: > > 'fields' => 'SOMETHING(a.gfdg+b.sdfdf) AS Bacon__Eggs' > > and this will be parsed into the Bacon model. But not for MySQL. > > There are quite a few model behaviors around to manage this. I wrote a > proof-of-concept one a while ago; there is a better one somewhere > around. > > (searching for links...) > > My code :http://openpaste.org/en/3929/ > Discussion:http://groups.google.com/group/cake-php/browse_thread/thread/eb0422c6... > Autofield/Truefield > :http://cakeexplorer.wordpress.com/2007/09/10/autofield-behavior-or-ho... > > It might also be possible to override/extend the datasource. I > generally do this anyway, for various reasons (syntax-hilighting SQL > logs, mainly) - it might not be too hard to provide a custom > implementation of resultSet(). > > hth > grigri --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
