src/Mapper.php
public function newObject($type, array $data = [])
    {
        $type = $this->getFullType($type);
        if (class_exists($type)) {
            $table = $type::getCollection();
            return new $type($data, $this->mongodb->$table, $this->cache);
        }
        return null;
    }
public function newObject($type, array $data = [])
    {
        $type = $this->getFullType($type);
        if (class_exists($type)) {
            $table = $type::getCollection();
            return new $type($data, $this->mongodb->$table, $this->cache);
        }
        return null;
    }
public function newObject ( $ type , array $ data = [ ] ) { $ type = $ this -> getFullType ( $ type ) ; if ( class_exists ( $ type ) ) { $ table = $ type :: getCollection ( ) ; return new $ type ( $ data , $ this -> mongodb -> $ table , $ this -> cache ) ; } return null ; }
Construct new object
@param string $type Name of class of object that should be constructed
@param array $data initial values of properties of new object
@return mixed new object of class $type or null if class $type does not exist
Construct new object