Field Is Not Defined

[b]Sorry, My English is bad,

I have a model, i created model fields with another model field values.

it showed error "*****" field is not defined.

I writed this [/b]


if(self::$fields){

        foreach (self::$fields as $field){

             public $field->varname;

        }

    }

[b]it didn’t work too.

This is my model[/b]





<?php

class CheckParams extends CFormModel

{

    static $fields=null;

    

    public function init()

    {

        parent::init();

        $this->loadProfileFields();

    }


    public function attributeLabels()

    {

        $labels=array();

        if(self::$fields)

            foreach (self::$fields as $field)

                $labels[$field->varname] = $field->name_ru;


        return $labels;

    }


    public function loadProfileFields()

    {

        if(self::$fields===null)

        {

            self::$fields=Params::model()->cache(3600)->findAll();

            if(self::$fields==null)

                self::$fields=array();

        }

        return self::$fields;

    }


}

hi, have you tried without caching the model?




self::$fields=Params::model()->findAll();



Did you var_dump the data from findAll()?

I have added a post to the guidlines.