/** * @param $identifier * @return BlogPostInterface|null */ public function getBlogPost($identifier) { $getOutput = $this->bucket->get($identifier); if ($getOutput->hasObject()) { $obj = $getOutput->getFirstObject(); $content = $obj->getContent(); if (!$obj->isDeleted() && isset($content)) { return RiakBlogPost::instanceFromJsonString($content); } } return null; }
public function testSerialization() { $bp = new RiakBlogPost(); $bp->setIsPublished(true); $bp->setContent('some content øæå'); $bp->setAuthorIdentifier('identifier'); $bp->setAuthorDisplayName('Display name'); $bp->setTitle('Plappe'); $json = json_encode($bp, true); $decodedBp = RiakBlogPost::instanceFromJsonString($json); $this->assertEquals($bp, $decodedBp); }