Property "x.x" is not defined.

Hello,

I’m trying to use a component that I have written, but I get an error:

The component code is this:




class Meta extends CApplicationComponent

{


	/**

	 *

	 * @var string

	 */

  protected $fieldName;


	/**

	 *

	 * @var string

	 */

	protected $table;


  /**

	 * If component is initialized

	 *

	 * @var bool

	 */

	protected $_init = false;


  /**

	 * Returns if component is initialized

	 *

	 * @return bool

	 */

	public function getIsInitialized()

	{

		return $this->_init;

	}


  public function init()

  {

		$this->_init = true;

	}


  public function get($object_id, $key)

  {

    return Yii::app()->db->createCommand()->select('meta_value')->from($this->table)->where($this->fieldName . '=: ' . $this->fieldName . ' AND meta_key=:meta_key', array(':' . $this->fieldName => $object_id, 'meta_key' => $key))->queryScalar();

  }

}



And in the configuration file I have added:




'companiesMeta' => array(

      'class' => 'application.extensions.Meta',

      'fieldName' => 'company_id',

      'table' => 'company_accounts_meta',

    )



Any ideas ?

Have you tried to set your component properties to public?

Could be it is just an access problem.

Aha, it works with the public properties. But shouldn’t it work with private properties as well ?