Ejemplo n.º 1
0
 public function testGetDefaultDatastore()
 {
     $datastore = \ntentan\Ntentan::getDefaultDataStore();
     $this->assertEquals($this->datastoreName, $datastore['datastore']);
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $modelInformation = new ReflectionObject($this);
     $last = explode("\\", $modelInformation->getName());
     $modelName = end($last);
     $this->name = strtolower(Ntentan::deCamelize($modelName));
     $this->route = implode(".", array_slice(explode("\\", $modelInformation->getName()), count(explode("/", Ntentan::$namespace)) + 1, -1));
     $this->iteratorPosition = 0;
     $dataStoreParams = Ntentan::getDefaultDataStore();
     $dataStoreClass = $dataStoreParams['datastore_class'];
     if (class_exists($dataStoreClass)) {
         $dataStore = new $dataStoreClass($dataStoreParams);
         $this->dataStore = $dataStore;
         $this->init();
         $this->dataStore->setModel($this);
     } else {
         throw new exceptions\DataStoreException("Datastore {$dataStoreClass} doesn't exist.");
     }
     foreach ($this->behaviours as $behaviour) {
         $this->addBehaviour($behaviour);
     }
 }
Ejemplo n.º 3
0
 public function open($sessionPath, $sessionName)
 {
     $this->db = Ntentan::getDefaultDataStore(true);
 }