Phactory\Mongo\Phactory::reset PHP Метод

reset() публичный Метод

* Delete created objects from the database, clear defined blueprints, and clear stored inflection exceptions.
public reset ( )
    public function reset()
    {
        $this->recall();
        $this->_blueprints = array();
        Inflector::reset();
    }

Usage Example

Пример #1
0
 public static function setUpBeforeClass()
 {
     self::$config = ['database' => 'reach_testing', 'host' => 'localhost', 'port' => 27017, 'options' => ['connect' => true, 'socketTimeoutMS' => 60000]];
     \Reach\Service\Container::register('mongo', self::$config, '\\Reach\\Mongo\\Connection');
     self::$connection = \Reach\Service\Container::getDI()->get('mongo');
     //ConnectionManager::registerConnection(self::$config);
     //self::$connection = ConnectionManager::getConnection();
     if (!self::$phactory) {
         if (!self::$connection->getDb() instanceof \MongoDB) {
             throw new \Exception('Could not connect to MongoDB');
         }
         self::$phactory = new Phactory(self::$connection->getDb());
         self::$phactory->reset();
     }
     //set up Phactory db connection
     self::$phactory->reset();
 }