Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

dynamic function can't be recgonized

I simply copied the code from INVO tutorial

$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 )); });

but it returns

Undefined variable: dbclass

I know it's dynamic function name, and the syntax seems all right, I can't understand it, can anyone help me?

the envirement is win7x64, WAMP-2.5x64, Phalcon-2.0.2 x64



7.4k
Accepted
answer
 $dbclass = 'Phalcon\Db\Adapter\Pdo\'

change to

 $dbclass = 'Phalcon\Db\Adapter\Pdo\\'

https://github.com/phalcon/invo/blob/master/app/config/services.php#L85