Aik Modle Se Dosre Say Dosre Modle Ke Member Funcin Ko Kasay Call Karen

masal ke tor pay mery pass two models hean propery and category ager mean property ke form per category ke dropdwon show karna chata hon to ye kass hoga

for example mean nay category ke modle mean aik functin banay hea like


  public function getCategoryList()

	{

			$c= new CDbCriteria;

			$c->select = 'catId, catName';

			$c->from = 'af_categories';

			$c->order = 'catName ASC';

			$category =	Categories::model()->findAllByPk($c);

			return $category;

	}

and isko mean call karta hon

property ke model pay


<div class="row">

		<?php echo $form->labelEx($model,'fkcategroyid'); ?>

		

		  <?php echo $form->dropDownList($model,'fkcategroyid', $model->categories->getStateList()); ?>

		<?php echo $form->error($model,'fkcategroyid'); ?>

	</div>

to fatal error show karta how how can i solve it

thanks in advance

urdu forum main khush amdeed

Darsal app aik cheez missing kr rahay ho wo ya kay dropDownlist main jo teesra argument hota hia wo array main key=>value based hota hia

to, app ka correct code kuch es tarha sy ho ga




<?php echo $form->dropDownList($model,'fkcategroyid', CHtml::listData($model->categories->getStateList(),'id','name')); ?>



Dossri baat ya hia ky app ko model ka jo function app call kr rahay hian wo (getStateList()) hia jub ky jo function app uper kh rahay hian wo getCategoryList hia.

main ya suggest krta hon ky app es ko es terha sy kr lian




<?php echo $form->dropDownList($model,'fkcategroyid', CHtml::listData(Categories::model()->findAll(),'catId','catName')); ?>



Aur ager app phr b relation sy ($model->categories->getCategoriesList()) sy krna cha rahay hian to us ka sahi code kuch youn banta hia




// function in categories model

public function getCategoryList()

{

$c= new CDbCriteria;

$c->select = 'catId, catName';

$c->from = 'af_categories';

$c->order = 'catName ASC';

$category = Categories::model()->findAll($c);

return $category;

}



Shukria

try this one

or visit www do yiitutorial do com

Main Yii Framework main Naya Hoo Main login ko kis tarah database kay saat connect karo

welcome to Yii family.

app ya extensions use kr skty ho

http://www.yiiframework.com/extension/account-module/

http://www.yiiframework.com/extension/yii-user/

http://www.yiiframework.com/extension/yii-user-management/

http://www.yiiframework.com/extension/login/

bhai muze yii2 me uploadify liabrary used karni hai iska process kya hai .kue ki mai cmd se use upload karta hu to woh token hidden ka error deta hai please help me. mai yyi development me naya hu

thanku mera tu masla he hal hogaya……