0

I'm trying to develope a simple crud with yii2 and I have problems because when I try to show a view I have a 404 Error

I have this structure

structure

And I'm trying to show the person view so I do this: http://localhost:83/yii2-proyecto/backend/web/index.php?r=personal/person and I have the 404 mistake but if I do http://localhost:83/yii2-proyecto/backend/web/index.php?r=personal everything works fine because the default view is showed.

In my config/main.php I have this piece of code:

<?php
   $params = array_merge(
   require(__DIR__ . '/../../common/config/params.php'),
   require(__DIR__ . '/../../common/config/params-local.php'),
   require(__DIR__ . '/params.php'),
   require(__DIR__ . '/params-local.php')
 );
 return [
   'id' => 'app-backend',
   'basePath' => dirname(__DIR__),
   'controllerNamespace' => 'backend\controllers',
   'bootstrap' => ['log'],
   'modules' => [
    'personal' => [
        'class' => 'backend\modules\Personal\Module',
       ],
   ],

On PersonalController I have this for index

public function actionIndex()
{
    $searchModel = new PersonSearch();
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

    return $this->render('index', [
        'searchModel' => $searchModel,
        'dataProvider' => $dataProvider,
    ]);
}

And I have imported this:

namespace backend\modules\personal\controllers;

use Yii;
use common\models\Person;
use backend\modules\Personal\models\PersonSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\User;
use yii\web\UploadedFile;

So I don't know why I have a 404 when I try to show the person view. Any idea?. Thanks a million

Carl35
  • 73
  • 1
  • 8
  • index.php?r=personal/person should start the default action (ie index unless redefined) in PersonController. Do you have an index action and not changed the default action? – karpy47 Sep 09 '17 at 08:06
  • I have the PersonalController with this piece of code which I have added so I don't know why doesn't work – Carl35 Sep 09 '17 at 08:24

0 Answers0