config/loader.php
$loader->registerNamespaces(array(
'Models\Entities' => dirname(__DIR__) . '/models/Entities/',
'Models\Services' => dirname(__DIR__) . '/models/Services/',
'Models\Repositories' => dirname(__DIR__) . '/models/Repositories/'
))
$loader->registerDirs(
array(
$config->application->controllersDir,
$config->application->modelsDir,
$config->application->libraryDir,
$config->application->modelsDir.'Entities/',
$config->application->modelsDir.'Repositories/',
$config->application->modelsDir.'Services/',
)
);
$loader->register();
models/Entities/Admins.php
namespace Models\Entities;
use Phalcon\Mvc\Model\Validator\Email as Email;
class Admins extends \Phalcon\Mvc\Model
{...}
models/Servies/Auth.php
namespace Models\Services;
class Auth extends \Phalcon\Mvc\User\Component {
public function login($username, $password){
....
$result = Models\Entities\Admins::find($parameters);
...
}
Error:
Fatal error: Class 'Models\Services\Models\Entities\Admins' not found in /webroot/app/models/Services/Auth.php on line 55
What is the correct way to use model in services ?