Hi.
There is big problem for beginners with that. So I'm trying to just show some variable from database. I'm basing on mutliple module from github.
Here is my Controller:
<?php
namespace Multiple\Frontend\Controllers;
use Phalcon\Mvc\Controller;
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Select;
(....)
public function indexAction()
{
// SET META DESCRIPTIONS
$projects = Projects::find(
array(
"limit" => 3
)
);
}
Easy as that.
And here is my Module autoloader:
public function registerAutoloaders()
{
$loader = new Loader();
$loader->registerNamespaces(array(
'Multiple\Frontend\Controllers' => '../apps/frontend/controllers/',
'Multiple\Frontend\Models' => '../apps/frontend/models/',
));
$loader->registerDirs(
array(
'formsDir' => '../apps/frontend/forms/',
'libraryDir' => '../apps/frontend/library/'
)
);
$loader->registerClasses(
array(
'Swift_Message' => '../apps/frontend/library/swift/swift_required.php',
'Swift_SmtpTransport' => '../apps/frontend/library/swift/swift_required.php',
'Swift_Mailer' => '../apps/frontend/library/swift/swift_required.php',
)
);
$loader->register();
}
Nothing fancy. Problem is that I get error: Fatal error: Class 'Multiple\Frontend\Controllers\Projects' not found, so Phalcon don't even have clue that I want to use my Model.
One big problem about Phalcon is that when amateurs who go from clear PHP to PHP Framework try to learn whole MVC thing, they don't have any examples. You'll say that we have tutorial - but tutorial is about single module app. You'll say that we have documentation - but documentation is assuming that you have rest of your project ready to go. You'll say that we have examples on github, but these examples are empty or just don't work with project what you already made with tutorials and docs.
This is big thing. I'm really not beginner in programming and documentations but I really have problems to understand PHalcon. Wherever I go project tree looks different. Try to make project with Developer Tools and it will not look like examples on github.
I would like to go with Phalcon, because performance. I would like to donate, help with translating documentation for my country, but for real, it's not opened for beginners in MVC design.