phalcon-rest
phalcon-rest copied to clipboard
Why I can't connect to mysql?
Hi everyone, I've used Phalcon micro for a couple of months, and now I want to switch to something more RESTful, and I found this repo https://github.com/cmoore4/phalcon-rest
-
I've declared database parameters in config.ini
[database] adapter = Mysql host = localhost username = test password = test name = test
-
I've set the di to connect to db
$di->set('db', function() use ($config) { $dbclass = 'Phalcon\Db\Adapter\Pdo\\' . $config->database->adapter; return new $dbclass(array( "host" => $config->database->host, "username" => $config->database->username, "password" => $config->database->password, "dbname" => $config->database->name )); });
-
Class Princesses.php in is models folder
-
When I tried to add this line
in the ExampleController.php, I got the blank page when going to host/v1/example. When I removed that line, everything is fine.$princesses = Princesses::find();
What is the problem here?
Thank you very much. Any help is appreciated!
In model directory file with class has name Princess.php, but class has name Princesses: ... use \PhalconRest\Exceptions\HTTPException;
class Princesses extends \Phalcon\Mvc\Model{ ... Rename class to Princess and check all references to this class in code.
hi please describ how to get data from mysql in this project i want to select data from my mysql db
can you help me????
can u help me and future user? i got same error.