コード例 #1
0
ファイル: JsonBodyParser.php プロジェクト: marviktintor/pos-1
 /**
  * @param string  $data
  * @param Request $request
  * @return mixed
  */
 public function parse($data, $request)
 {
     try {
         return $this->serializer->unserialize($data);
     } catch (Exception $exception) {
         throw new InvalidBodyException(sprintf('Could not parse body of request with path %s and method %s', $request->getPath(), $request->getMethod()), 1413214227, $exception);
     }
 }
コード例 #2
0
 /**
  * Unserialize the given data
  *
  * @param string $string
  * @throws \Cundd\PersistentObjectStore\Serializer\Exception if the data could not be unserialized
  * @return mixed
  */
 public function unserialize($string)
 {
     $data = parent::unserialize($string);
     if ($data === NULL) {
         return NULL;
     }
     $databaseIdentifier = ObjectUtility::valueForKeyPathOfObject(Constants::DATA_META_KEY . '.' . Constants::DATA_DATABASE_KEY, $data, '');
     if ($databaseIdentifier) {
         GeneralUtility::assertDatabaseIdentifier($databaseIdentifier);
     }
     return new Document($data, $databaseIdentifier);
 }
コード例 #3
0
ファイル: Reader.php プロジェクト: marviktintor/pos-1
 /**
  * Loads the given meta database
  *
  * @param string $databaseIdentifier
  * @return array<Document>
  */
 protected function _loadMetaDataCollection($databaseIdentifier)
 {
     $path = ConfigurationManager::getSharedInstance()->getConfigurationForKeyPath('dataPath') . $databaseIdentifier . '.meta.json';
     if (!file_exists($path)) {
         return array();
     }
     $lock = Factory::createLock($databaseIdentifier);
     $lock->lock();
     $fileData = file_get_contents($path);
     $lock->unlock();
     //		DebugUtility::printMemorySample();
     $serializer = new JsonSerializer();
     $dataCollection = $serializer->unserialize($fileData);
     //		DebugUtility::printMemorySample();
     return $dataCollection;
 }
コード例 #4
0
ファイル: Writer.php プロジェクト: marviktintor/pos-1
 /**
  * Returns the string that will be written to the file system
  *
  * @param DatabaseInterface $database
  * @return string
  */
 protected function _getDataToWrite($database)
 {
     $objectsToWrite = $this->_getObjectsWrite($database);
     $serializer = new JsonSerializer();
     return $serializer->serialize($objectsToWrite);
 }