/**
  * @see BackendAdapter::createResource
  */
 public function createResource(Resource $resource)
 {
     $id = $this->conn->getDatabasePlatform()->getName() == 'mysql' ? null : $this->conn->fetchColumn($this->conn->getDatabasePlatform()->getSequenceNextValSQL('xi_filelib_resource_id_seq'));
     $this->conn->insert('xi_filelib_resource', array('id' => $id, 'uuid' => $resource->getUuid(), 'hash' => $resource->getHash(), 'date_created' => $resource->getDateCreated()->format('Y-m-d H:i:s'), 'mimetype' => $resource->getMimetype(), 'exclusive' => $resource->isExclusive(), 'filesize' => $resource->getSize(), 'data' => json_encode($resource->getData()->toArray())), array(PDO::PARAM_INT, PDO::PARAM_STR, PDO::PARAM_STR, PDO::PARAM_STR, PDO::PARAM_STR, PDO::PARAM_BOOL, PDO::PARAM_INT, PDO::PARAM_STR));
     $id = $this->conn->getDatabasePlatform()->getName() == 'mysql' ? $this->conn->lastInsertId() : $id;
     $resource->setId($id);
     return $resource;
 }
 /**
  * @see BackendAdapter::createResource
  */
 public function createResource(Resource $resource)
 {
     $document = array('hash' => $resource->getHash(), 'uuid' => $resource->getUuid(), 'mimetype' => $resource->getMimetype(), 'size' => $resource->getSize(), 'date_created' => $resource->getDateCreated()->format('Y-m-d H:i:s'), 'data' => $resource->getData()->toArray(), 'exclusive' => $resource->isExclusive());
     $document['id'] = $this->createId();
     $this->create('resources', $document['id'], $document);
     $resource->setId($document['id']);
     return $resource;
 }
 /**
  * @see BackendAdapter::updateResource
  */
 public function updateResource(Resource $resource)
 {
     try {
         $resourceRow = $this->em->getReference($this->getResourceEntityName(), $resource->getId());
         $resourceRow->setUuid($resource->getUuid());
         $resourceRow->setData($resource->getData()->toArray());
         $resourceRow->setExclusive($resource->isExclusive());
         $resourceRow->setHash($resource->getHash());
         $this->em->flush($resourceRow);
         return true;
     } catch (EntityNotFoundException $e) {
         return false;
     }
 }
 /**
  * @see BackendAdapter::createResource
  */
 public function createResource(Resource $resource)
 {
     $document = array('uuid' => $resource->getUuid(), 'hash' => $resource->getHash(), 'mimetype' => $resource->getMimetype(), 'size' => $resource->getSize(), 'date_created' => new MongoDate($resource->getDateCreated()->getTimestamp()), 'data' => $resource->getData()->toArray(), 'exclusive' => $resource->isExclusive());
     $this->getMongo()->resources->ensureIndex(array('hash' => 1), array('unique' => false));
     $this->getMongo()->resources->insert($document, array('w' => true));
     $resource->setId((string) $document['_id']);
     return $resource;
 }