foreach ($results as $result) {
    $source = $result->source();
    $sourceSchema = TableRegistry::get($source)->schema();
}

Usually all records in a result set are of the same table, so you on;y need 
to do that for the first result.

If you have associations, then you can get the property in the result:

$associationSource = $result->association_property->source();


On Thursday, January 22, 2015 at 9:07:31 AM UTC+1, Ernesto wrote:
>
> Hi all
>
> i'm migrating an HtmlTableHelper from a Cake 2.x project to  new 3.0 one
>
> The main function of this helper scans the array of data passed as 
> argument and uses ClassRegistry to obtain schemas for each Model.field.
> Later on these informations are used to format the TDs (text fields 
> justified to the left, number fields justified to the right and so on).
>
> in 3.0 data arrays are gone, replaced by resultsets.
>
> I tried to rewrite a similar approach but i'm struggling with Cake's new 
> ORM
>
> what's the best way to get source table and schema of each field in a 
> recordset?
>
> Thank you very much
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to