Yii Framework Forum: is there any cache for yii running environment - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

is there any cache for yii running environment Rate Topic: -----

#1 User is offline   kevin2010 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 17-January 10

Posted 05 March 2010 - 04:30 PM

i have a model A without field 'thumb', after then i added a new field 'thumb' in the datebase, and modified the model as below:

public function tableName()
	{
		return '{{Photos}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('status, user_id', 'required'),
			array('status, photocate_id, events_id, user_id', 'numerical', 'integerOnly'=>true),
			array('image,thumb, note', 'length', 'max'=>128),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'image' => 'Image',
			'thumb' => 'Thumb',
			'note' => 'Note',
			'create_time' => 'Create Time',
			'status' => 'Status',
			'photocate_id' => 'Photocate',
			'events_id' => 'Events',
			'user_id' => 'User',
		);
	}
}



then in the controll:
$model->thumb=$thumbname;


yii keep saying:
CException
Description

Property "Photos.thumb" is not defined.
Source File

C:\xampp\htdocs\lib\framework\db\ar\CActiveRecord.php(122)

00110:      * PHP setter magic method.
00111:      * This method is overridden so that AR attributes can be accessed like properties.
00112:      * @param string property name
00113:      * @param mixed property value
00114:      */
00115:     public function __set($name,$value)
00116:     {
00117:         if($this->setAttribute($name,$value)===false)
00118:         {
00119:             if(isset($this->getMetaData()->relations[$name]))
00120:                 $this->_related[$name]=$value;
00121:             else
00122: parent::__set($name,$value);
00123:         }
00124:     }
00125: 
00126:     /**
00127:      * Checks if a property value is null.
00128:      * This method overrides the parent implementation by checking
00129:      * if the named attribute is null or not.
00130:      * @param string the property name or the event name
00131:      * @return boolean whether the property value is null
00132:      * @since 1.0.1
00133:      */
00134:     public function __isset($name)

Stack Trace

#0 C:\xampp\htdocs\lib\framework\db\ar\CActiveRecord.php(122): CComponent->__set('thumb', NULL)
#1 C:\xampp\htdocs\protected\controllers\PhotosController.php(101): CActiveRecord->__set('thumb', NULL)
#2 C:\xampp\htdocs\lib\framework\web\actions\CInlineAction.php(32): PhotosController->actionCreate()
#3 C:\xampp\htdocs\lib\framework\web\CController.php(300): CInlineAction->run()
#4 C:\xampp\htdocs\lib\framework\web\filters\CFilterChain.php(129): CController->runAction(Object(CInlineAction))
#5 C:\xampp\htdocs\lib\framework\web\filters\CFilter.php(41): CFilterChain->run()
#6 C:\xampp\htdocs\lib\framework\web\CController.php(983): CFilter->filter(Object(CFilterChain))
#7 C:\xampp\htdocs\lib\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#8 C:\xampp\htdocs\lib\framework\web\filters\CFilterChain.php(126): CInlineFilter->filter(Object(CFilterChain))
#9 C:\xampp\htdocs\lib\framework\web\CController.php(283): CFilterChain->run()
#10 C:\xampp\htdocs\lib\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#11 C:\xampp\htdocs\lib\framework\web\CWebApplication.php(320): CController->run('create')
#12 C:\xampp\htdocs\lib\framework\web\CWebApplication.php(120): CWebApplication->runController('photos/create')
#13 C:\xampp\htdocs\lib\framework\base\CApplication.php(135): CWebApplication->processRequest()
#14 C:\xampp\htdocs\index.php(11): CApplication->run()
#15 {main}




i thought i have definded thumb, why yii still says thie error?
thanks!
0

#2 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 05 March 2010 - 04:46 PM

Do you have a column called `thumb` in the `photo` table? You did not really say clearly..
http://php-thoughts.cubedwater.com - my bloggings about Yii
0

#3 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 05 March 2010 - 04:47 PM

why are there brackets in the table name?
http://php-thoughts.cubedwater.com - my bloggings about Yii
0

#4 User is offline   Theill11 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 03-March 10
  • Location:@ localhost

Posted 05 March 2010 - 05:33 PM

If you have set "schemaCachingDuration" under det DB-section in main.php, you can delete the cache directory under protected/runtime.

Edit: You can refresh the tables metadata, see: http://www.yiiframew...MetaData-detail

@jonah: The brackets I think is for tableprefix.
0

#5 User is offline   kevin2010 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 17-January 10

Posted 05 March 2010 - 06:34 PM

Thanks very much, i just cleared cache and fixed.

i do have set "schemaCachingDuration" under det DB-section in main.php, but do not fully understand before.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users