[Solved] How to use adapters?

Hello, how can I use adapters (for example Database adapter) like this: https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Session/Adapter in my pure phalconphp 1.1.0? I have to compile incubator or what? I can't find any documentation or informations connected with it.



85.3k

The README explains how to do that, you need to set up an autoloader in your app that points to the incubator:

https://github.com/phalcon/incubator/blob/master/README.md#autoloading-from-the-incubator



702

I did it. But a problem is still the same. Fatal error: Class 'Phalcon\Session\Adapter\Database' not found in C:\xampp\htdocs\phalconphp\invo-master\public\index.php on line 130 I put Library folder in to invo-master (C:\xampp\htdocs\phalconphp\invo-master\Library\Phalcon) and setup autoloader like this: 'Phalcon' => '/phalconphp/invo-master/Library/Phalcon/', but application still not able to find these classes



85.3k

Is /phalconphp/invo-master/Library/Phalcon/ a valid path in your system?



702

Yep, because for example baseUri this works fine. baseUri = /phalconphp/invo-master/ In the other way this: 'Phalcon' => DIR . '/../Library/Phalcon/' does'nt work too. If for controllers everything works fine, so where is the problem?



31.2k

Hi, I use: 1/ in config: 'libraryDir' => DIR . '/../../app/library/', 2/ in public/index.php: $loader->registerDirs( array( $config->application->controllersDir, $config->application->modelsDir, $config->application->libraryDir ) ); and it's OK !



702

Yes yes yes!!! It works. Thanks a lot!