Reputation: 2029
I have the next code snippet:
$di = new FactoryDefault();
...
$di->setShared('mongo', function($di) use ($di) {
return new Models\MongoDb\Manager($di);
});
The code works fine, but PHP log says:
Warning: Missing argument 1 for {closure}() in
/var/www/merkaz.gq/public_html/v1/index.php on line 63
Any ideas ?
Upvotes: 0
Views: 122
Reputation: 3381
In Phalcon 2.1 you can use:
$di->setShared('mongo', function() {
return new Models\MongoDb\Manager($this);
});
Upvotes: 1
Reputation: 36964
Because your clousure is not called with the $di
argument. Change
function($di) use ($di) {
to
function() use ($di) {
Upvotes: 2