/** * Serialize the given data * * @param mixed $data * @throws \Cundd\PersistentObjectStore\Serializer\Exception if the data could not be serialized * @return string */ public function serialize($data) { if ($data instanceof DocumentInterface) { $objectData = $data->getData(); $objectData[Constants::DATA_META_KEY] = array('guid' => $data->getGuid(), 'database' => $data->getDatabaseIdentifier(), 'creationTime' => $data->getCreationTime(), 'modificationTime' => $data->getModificationTime()); return parent::serialize($objectData); } return parent::serialize($data); }
/** * 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); }