public function __construct($model = null) { if (!empty($model)) { $this->models[] = $model; } if (!empty($model)) { $this->manganel = Manganel::create($model); } else { $this->manganel = Manganel::fly(); } }
public function __construct($model) { $this->model = $model; $this->meta = ManganelMeta::create($this->model); if (!empty($this->meta->type()->indexId) && false !== $this->meta->type()->indexId) { $this->isIndexable = true; } if ($this->isIndexable) { if (!isset($this->model->_id)) { throw new ManganelException(sprintf('Property `_id` is not set in model `%s`, this is required by Manganel', get_class($this->model))); } $this->manganel = Manganel::create($this->model); } }
public function testIfWillDropIndex() { $model = new SimpleModel(); $model->_id = new MongoId(); $model->title = 'Jersey'; $im = new IndexManager($model); $im->index(); $found = $im->get(); // Check if is indexed $this->assertTrue($found instanceof SimpleModel); $this->assertSame($model->title, $found->title); $result = Manganel::create($model)->drop(); codecept_debug($result); try { $im->get(); $this->assertFalse(true); } catch (Missing404Exception $ex) { $this->assertTrue(true); } }