kazio
(Kontakt)
August 31, 2012, 12:23pm
1
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 ?
sjakie
(Arjanwestdorp)
August 31, 2012, 1:27pm
2
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.
Keith
(Kburton)
August 31, 2012, 1:44pm
3
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.
kazio
(Kontakt)
August 31, 2012, 1:54pm
4
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