/**
  * {@inheritdoc}
  */
 public function serializeOne($id)
 {
     list($fileId, $ownerEntityClass, $ownerEntityId) = $this->attachmentManager->parseFileKey($id);
     if (!$this->securityFacade->isGranted('VIEW', new ObjectIdentity($ownerEntityId, $ownerEntityClass))) {
         throw new AccessDeniedException();
     }
     return parent::serializeOne($fileId);
 }
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Invalid file key: "Invalid Key".
  */
 public function testParseInvalidFileKey()
 {
     $this->attachmentManager->parseFileKey('Invalid Key');
 }