Class 'Images' not found on Forms action search

Hello, im reading the Tutorial4 Using CRUDs and im stuck into forms action search, can someone help me?

Error: Fatal error: Class 'Images' not found in C:\xampp\htdocs\board\app\controllers\ImagesManagerController.php on line 45

ImagesManagerController.php

Images should be an existing model class in the global namespace. You may not have such a class, declared it under a namespace or haven't set up the loader properly.



36.5k

Hey

As the comment of Lajos you should have a class Images in directory model and add namespace for the scripts above:

use Phalcon\Mvc\Model\Criteria;
use Phalcon\Paginator\Adapter\Model as Paginator;
use Board\Forms\ImagesManagerForm;
use Board\Models\Images;
edited Apr '16

Hi,

I have the same problem here. I double-checked based upon your suggestions, it still does not work. Here is the code http://pastebin.com/sygTd9Fj

It stops at line 19 with

Fatal error: Class 'Category' not found in /home/ubuntu/workspace/application/apps/cms/controllers/CategoryController.php on line 19

I set up a multi module architecture and scaffolded the code with the latest devtools. I had to fix some class names here and there but overall, everything is fine except the search function. It is like Criteria does not know the Category class, but I cannot figure out why.

Can you guys help please ?

Fixed it in two steps, since my model is in a namespace use Application\Cms\Models\Page as Page; then in the method $query = Criteria::fromInput($this->di, Page::class, $_POST);

Is it the correct way to do it or is it wrong to put my models in the module's namespace ? I am new to this (coming from CodeIgniter)

Hi Vincent D.,
thanks for your post, you got me on the right track.
However in my case it was sufficient to use Users::class. The alternative is providing a String containing the fully qualified class name of the model, which is in my case "Backend\\Webapp\\Models\\Users". A lot of typing and escaping, so I prefer Users::class.

Cheers Sebastian