fuel/docs — Issue #247: Confusion creating Classes
Author: thomasedwards
Created: 2011-11-15 16:09:09+00:00
State: open

On the Models page, the instructions for creating a Model are as such:

```
namespace Model;

class Welcome extends Model {

public static function get_results()
{
// Database interactions
}

}
```

Which I’ve used in a Model I’ve made like so:

```
namespace Model;

class Users extends Model
{

public static function create($pairs)
{
return DB::insert('users')->set($pairs)->execute();
}

}
```

First error is ```ErrorException [ Error ]: Class 'Model\Model' not found``` which is reasonable, as I haven’t created a Model class to extend from. So I remove that line.

Then I get ```ErrorException [ Error ]: Class 'Model\DB' not found``` referring to the line calling ```DB::insert```. That seems reasonable, because I’m in the Model namespace? But obviously I remove that, then the Controller can’t find the Model.

I’m not sure what the correct way of managing it is?