Dynamic Column Names In A Scope

Hi,

I’m having a strange problem and no more ideas…

In short, I have this issue: a query generated by a controller call to findAll (with a few scopes) gives a different result when manually ran (by phpmyadmin).

I load my page and check for a query from page debug log. I copy it and run it in phpmyadmin.

When in phpmyadmin, I get back all column values as expected (it’s a pivot table with rows dynamically built by a scope function).

Surprisingly, when I check the result set returned from the controller only a subset of all columns are populated, while the remaining are present but all empty (valued ‘’, edited here to correct assigned value).

Now, columns (apart from the first four, with values ok) are added within a scope with dynamic names (prid_0, pric_0, dd_0, prid_1, pric_1, dd_1, prid_2… and so on up to dd_15).

All dynamic (!) column names have been declared as public in model, have an AttributeLabel, a rule (like “array(‘prid_0, pric_0, dd_0’,‘safe’)”) and are returned by my controller’s search function.

I’ve repeated the query with different number of columns and the generated query is always correct, in phpmyadmin the query always returns the expected list of values.

When run by my controller though, only the first set of dynamic columns gets populated (i.e. fields named prid_0, pric_0 and dd_0), all the remaining columns are empty.

How can this be?

What else should I check in my model?

I’m almost sure something’s missing in it, causing dynamic columns to remain empty but I’ve really ran out of ideas.

Any hint/help, veeery appreciated.

Thanks!

rash*

Why you don’t debug/step through models findAll/populateRecords methods?