Add attributes to model after query

How can I add attributes to model after query table with attributes names,

I have table with attributes, I want to use them in model.

I selected and now its in query answer as attribute_1…x columns.

but if I want to use them i must declare it first

public $attribute_1;

but i dont know how many attributes are in table.

So i need to add them to model after query.

Is it possible ?

I dont’t know what you exactly want to do. Derives your model from the CActiveRecord class? Because then you can call the onAfterFind method and add attributes.

I guess this is some sort of EAV implementation? It’s not clear from your description. I’m sure what you’re attempting can be achieved though.

all I need is add CActiveRecord attributes after it inits, dynamically, I dont know attributes names and count, i need get them from db.

or from findAll() answer columns