Exemplo n.º 1
0
 public function test_create_db()
 {
     $dm = new \DataManager();
     system("rm -Rvf " . $dm->dataRoot . "/*");
     $obj1 = $dm->getDefaultDocument();
     $obj1->unique_identifier = "robert_blackwell";
     $dm->putFile("robert_blackwell", $obj1);
     $obj1->unique_identifier = "blackwells";
     $dm->putFile("blackwells", $obj1);
 }
Exemplo n.º 2
0
 /**
  * Returns status 200 on success, 400 on already exists, any thing else is an error
  */
 function createFile($name)
 {
     $dataManager = new \DataManager();
     if ($dataManager->fileExists($name)) {
         return new JsonResponse(["error" => ["errorCode" => "1001", "message" => "The document [{$name}] already exists"]], 200);
     }
     $doc = $dataManager->getDefaultDocument();
     $doc->document_name = $name;
     $doc->id = uniqid();
     $dataManager->putDocument($name, $doc);
     return $this->load($name);
 }