Hello Andy, thanks for your quick response ! I tried this solution. I correctly load the library and its namespace but when i try a simple request like: Musics::find(), I've this message:
The argument is not initialized or iterable()<br><pre>#0 [internal function]: Phalcon\Mvc\Collection::cloneResult(Object(Musics), Object(Phalcon\Db\Adapter\MongoDB\Model\BSONDocument))
#1 [internal function]: Phalcon\Mvc\Collection::_getResultset(Array, Object(Musics), Object(Phalcon\Db\Adapter\MongoDB\Database), false)
#2 /var/www/adminapi/app.php(11): Phalcon\Mvc\Collection::find()
#3 [internal function]: Closure->{closure}()
#4 /var/www/adminapi/public/index.php(38): Phalcon\Mvc\Micro->handle()
#5 {main}
My model:
use Phalcon\Mvc\Collection;
use Phalcon\Mvc\Model\Validator\PresenceOf;
use Phalcon\Mvc\Model\Validator\Numericality;
use Phalcon\Mvc\Model\Validator\StringLength;
class Musics extends Collection
{
public function getSource()
{
return 'musics';
}
}
Any idea ?
Thanks