I have a class:
class MongoConnection
{
private $_m;
private $_db;
private $_collection;
public function _connect($dbname, $dbcollection)
{
}
}
In another class I want to use this like as:
class Object
{
private $collection;
public function __construct(MongoConnection $mongoConnection)
{
$mongoConnection->_connect("", "");
}
}
But it does not work for me. I get an error:
Catchable fatal error: Argument 1 passed to Object::__construct() must be an instance of MongoConnection, none given, called in..
I create instance of Object class as: $object = new Object();
Aucun commentaire:
Enregistrer un commentaire