/** * Transfrom claim into an array * * @param Claim $claim * @return array * @throws \LogicException If $claim is not a Claim instance */ public function toArray($claim) { if (!$claim instanceof Claim) { throw new \LogicException('ClaimArrayizer can only arrayize Claim objects'); } return ['_id' => $claim->getId(), 'type' => 'wb:claim', 'title' => 'Ansökan ' . $claim->getId(), 'contact' => $this->contactArrayizer->toArray($claim->getContact()), 'account' => $this->accountArrayizer->toArray($claim->getAccountWrapper()), 'requested' => $claim->getRequestedAmount()->getAmount(), 'approved' => $claim->getApprovedAmount()->getAmount(), 'comment' => $claim->getComment(), 'created' => $claim->getCreated()->format(self::DATE_FORMAT), 'updated' => $claim->getUpdated()->format(self::DATE_FORMAT)]; }
public function getKey(Claim $claim) { return $claim->getContact()->getId(); }