コード例 #1
0
 /**
  * @param NewConnectionRevision $newRevision
  * @return ConnectionDto
  */
 public function disassemble(NewConnectionRevision $newRevision)
 {
     $connection = $newRevision->getConnection();
     $dto = new ConnectionDto();
     $dto->revisionNote = $newRevision->getRevisionNote();
     // The API will ignore this, but we send it anyway for easier debugging.
     $dto->revisionNr = $connection->getRevisionNr();
     $dto->isActive = $connection->isActive();
     $dto->name = $connection->getName();
     $dto->id = $connection->getId();
     $dto->state = $connection->getState();
     $dto->type = $connection->getType();
     $dto->metadataUrl = $connection->getMetadataUrl();
     $dto->manipulationCode = $connection->getManipulationCode();
     $dto->metadata = $this->expand($connection->getAllMetadata());
     $dto->arpAttributes = $connection->getArpAttributes()->toArray();
     $dto->disableConsentConnections = $this->disassembleReferences($connection->getConsentDisabledConnections());
     $dto->allowedConnections = $this->disassembleReferences($connection->getAccess()->getAllowedConnections());
     $dto->blockedConnections = $this->disassembleReferences($connection->getAccess()->getBlockedConnections());
     $dto->allowAllEntities = $connection->getAccess()->isAllowAll();
     $dto->createdAtDate = $connection->getCreatedDate()->format('c');
     $dto->updatedAtDate = $connection->getUpdatedAtDate()->format('c');
     return $dto;
 }
コード例 #2
0
 /**
  * @param NewConnectionRevision $newRevision
  * @return Connection
  */
 public function update(NewConnectionRevision $newRevision)
 {
     $url = $this->getConnectionUrl($newRevision->getConnection()->getId());
     $request = $this->client->put($this->client->getBaseUrl() . $url, $this->HEADERS, $this->serializer->serialize($this->disassembler->disassemble($newRevision), 'json'));
     $response = $request->send();
     $this->statusCodeValidator->validate(201, $url, $request, $response);
     return $this->mapJsonToConnection($response->getBody(true));
 }