/** * Create the specified folder. * I dont understand why this exists with the provided $folder. Surely if we want to * create a folder we should be calling the $folders constructor or one of its static * creation methods? * @param FolderInterface $folder - the folder to be created? * @param FolderInterface $parent - the folder the new folder will be within. * * @return FolderInterface - the newly created folder. */ public function createFolder(FolderInterface $folder, FolderInterface $parent) { $gridFs = ConnectionHandler::getInstance()->getConnection(); $parentMongoFolder = MongoFolder::loadFromFolderInterface($parent); if ($folder->getCreatedTime() === null) { $folder->setCreatedTime(time()); } $metadata = array('name' => $folder->getName(), 'path' => $parent->getPath() . '/' . $parent->getName(), 'creation_time' => $folder->getCreatedTime(), 'parent' => $parentMongoFolder->getMongoId(), 'type' => 'folder'); print "creating folder with details: " . print_r($metadata, true); $gridFs->storeBytes("", $metadata); # folder is an empty file with metadata $mongoFolder = MongoFolder::loadFromFolderInterface($folder); return $mongoFolder; }