Beispiel #1
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);
 }