add() public method

public add ( object $object )
$object object
 /**
  * Imports a resource (file) from the given upload info array as a persistent
  * resource.
  *
  * On a successful import this method returns a PersistentResource object representing
  * the newly imported persistent resource.
  *
  * @param array $uploadInfo An array detailing the resource to import (expected keys: name, tmp_name)
  * @param string $collectionName Name of the collection this uploaded resource should be added to
  * @return PersistentResource A resource object representing the imported resource
  * @throws Exception
  */
 public function importUploadedResource(array $uploadInfo, $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME)
 {
     $this->initialize();
     if (!isset($this->collections[$collectionName])) {
         throw new Exception(sprintf('Tried to import an uploaded file into the resource collection "%s" but no such collection exists. Please check your settings and HTML forms.', $collectionName), 1375197544);
     }
     /* @var CollectionInterface $collection */
     $collection = $this->collections[$collectionName];
     try {
         $uploadedFile = $this->prepareUploadedFileForImport($uploadInfo);
         $resource = $collection->importResource($uploadedFile['filepath']);
         $resource->setFilename($uploadedFile['filename']);
     } catch (Exception $exception) {
         throw new Exception(sprintf('Importing an uploaded file into the resource collection "%s" failed.', $collectionName), 1375197680, $exception);
     }
     $this->resourceRepository->add($resource);
     $this->systemLogger->log(sprintf('Successfully imported the uploaded file "%s" into the resource collection "%s" (storage: "%s", a %s. SHA1: %s)', $resource->getFilename(), $collectionName, $this->collections[$collectionName]->getStorage()->getName(), get_class($this->collections[$collectionName]->getStorage()), $resource->getSha1()), LOG_DEBUG);
     return $resource;
 }