public function __construct(MongoClient $mongo, $dbName, $directory) { $config = new Configuration(); $config->addModelPath($directory); if (!ini_get('production')) { $config->development(); } parent::__construct($config, $mongo, $dbName); }
public function __construct(Configuration $config, Watch $watcher) { $this->config = $config; $collections = new Generate\Collections((array) $config->getModelPath(), $this); $this->fixPath($collections); $target = $config->getLoader(); $namespace = "ActiveMongo2\\Namspace" . uniqid(true); $rnd = uniqid(); $valns = $collections->getValidatorNS(); $validator = $collections->getValidator(); class_exists("agpmedia\\FileUtil\\File"); // preload class $args = compact('docs', 'namespace', 'mapper', 'indexes', 'self', 'collections', 'valns', 'rnd', 'validator'); $code = Template\Templates::get('documents')->render($args, true); if (strlen($code) >= 1024 * 1024) { File::write($target, $code); } else { File::write($target, FixCode::fix($code)); } $this->writeFileWatch($watcher, $collections); }
public function __construct(Configuration $config, MongoClient $conn, $db) { $this->config = $config; $this->cache = $config->getCache(); $this->mapper = $config->initialize($this); $this->conn = array('default' => $conn); $this->db = array('default' => $conn->selectDB($db)); $this->ns = array('default' => $config->getNamespace()); $this->mapper->setDatabases($this->db, $this->ns); if ($config->hasGenerated() || $config->isDevel()) { $this->ensureIndex(true); } }
public function testWriteConcern() { $x = new Configuration(); $x->setWriteConcern(3); $this->assertEquals(3, $x->getWriteConcern()); }