public function putStatement(StatementId $id, Statement $statement) { if (null !== $statement->getId() && !$id->equals($statement->getId())) { throw new ConflictException(sprintf('Id parameter ("%s") and statement id ("%s") do not match.', $id->getValue(), $statement->getId()->getValue())); } try { $existingStatement = $this->repository->findStatementById($id->getValue()); } catch (NotFoundException $e) { $this->repository->storeStatement($statement, true); } return new Response('', 204); }
/** * {@inheritdoc} */ public final function findVoidedStatementById(StatementId $voidedStatementId, Actor $authority = null) { $criteria = array('id' => $voidedStatementId->getValue()); if (null !== $authority) { $criteria['authority'] = $authority; } $mappedStatement = $this->repository->findStatement($criteria); if (null === $mappedStatement) { throw new NotFoundException('No voided statements could be found matching the given criteria.'); } $statement = $mappedStatement->getModel(); if (!$statement->isVoidStatement()) { throw new NotFoundException('The stored statement is no voiding statement.'); } return $statement; }
/** * {@inheritDoc} */ public function getVoidedStatement(StatementId $statementId, $attachments = true) { return $this->doGetStatements('statements', array('voidedStatementId' => $statementId->getValue(), 'attachments' => $attachments ? 'true' : 'false')); }