RESTful Api doc Example help

Hi there,

I am new to YII and need some help configuring my webserver and YII for the RESTful example in the 2.0-doc.

I think I am missing something. I build everything based on the basic example.

I created the UserController and edited the config like said.

After that I am getting a 404 when i call /myip/yii/basic/web/users

How can i debug that 404 to see what is missing? I think it is maybe something with the apache rewrite settings.

Thanks for your help.

Hey guys,

i figured out what was the problem. It was just a missconfiguration of my Apache.

Now the routing works just fine but i am running into a new Error.

I think i don’t have the right user model with which the ActiveController can build the REST api. Is that right?

Here is the errormessage: PHP Fatal ErrorCall to undefined method app\models\User::find()1yii\base\ErrorException/var/www/.../yii/basic/vendor/yiisoft/yii2/rest/IndexAction.php61#0 [internal function]: yii\base\ErrorHandler->handleFatalError()#1 {main}

I am now using the model from the advanced api example.

Any ideas?

Sorry guys,

had to read a bit more deeply.

filled the controller like following now and it works:


<?php


namespace app\models;


use yii\db\ActiveRecord;


class User extends ActiveRecord

{

    /**

     * @return string the name of the table associated with this ActiveRecord class.

     */

    public static function tableName()

    {

        return 'user';

    }

}