Dibesjr
Dibesjr

Reputation: 496

ErrorException [ Error ]: Class 'Model_Search' not found

I moved from my localhost to my web host to test out the application, and everything works as expected but when i tried to use a model that i generated via oil, it throws that error, saying the class doesn't exist, when it does.

The code i am using:

use \Model\Search;

class Controller_Search extends Controller_Template
{
    public function action_search()
    {
        if ($_POST['Search']) {
            $name['communities'] = Model_Search::query()->where('zip', '=', $_POST['Search'])->get();
            $name['count'] = count($name['communities']);
            $this->template->title = 'Search » Search';
            $name['canShow'] = true;
            $this->template->content = View::forge('search/search', $name);

        } else {
            $name['count'] = 0;
            $this->template->title = 'Search » Search';
            $name['canShow'] = false;
            $this->template->content = View::forge('search/search', $name);
        }
    }

}

The question is, What is causing this? and how do i fix it??

Upvotes: 0

Views: 814

Answers (1)

WanWizard
WanWizard

Reputation: 2574

Both in definition and to the autoloader, \Model\Search is different from \Model_Search, even though both point to the same file.

So make up your mind on how you want to use your models, and be consistent.

Upvotes: 1

Related Questions