Search code examples
phpyiiyii-extensions

include(MultiModelForm.php): failed to open stream: No such file or directory


 <?php
if(!isset($data)) {$data=array(); };
    $this->widget('ext.multimodelform.MultiModelForm',array(
        'id' => 'id_ssc_affliations', //the unique widget id
        'formConfig' => $myFormConfig, //the form configuration array
        'model' => $model, //instance of the form model
        'tableView'=>true,
        'data'=>$data,
        'bootstrapLayout'=>true,
        'addItemAsButton'=>true,
        'jsAfterNewId'=>MultiModelForm::afterNewIdDateTimePicker($myFormConfig['elements']),

        //if submitted not empty from the controller,
        //the form will be rendered with validation errors
        //'validatedItems' => $validatedMembers,

        //array of member instances loaded from db
        //'data' => $member->findAll('groupid=:groupId', array(':groupId'=>$model->id)),
    ));
?>

I'm getting this error please help me

Error 500 include(MultiModelForm.php): failed to open stream: No such file or directory


Solution

  • Add

    Yii::import('ext.multimodelform.MultiModelForm'); 
    

    at the top of this file.

    I assume $this->widget() implicitly imports the MultiModelForm class too.

    The problem is that you pass MultiModelForm::afterNewIdDateTimePicker($myFormConfig['elements']) as an argument to it. So your app should know the class MultiModelForm in advance before calling the widget() function. Adding explicit import at the top should solve this problem.