<?php
namespace MobileAppApi\Entity;
use App\Entity\User;
use App\Utility\DateTimeUtility;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="mobile_app_api_call_log_entries",
* indexes={
*
* @ORM\Index(name="created_at", columns={"created_at"}),
* @ORM\Index(name="users_id", columns={"users_id"}),
* @ORM\Index(name="mobile_app_api_keys_id", columns={"mobile_app_api_keys_id"})
* }
* )
*/
class CallLogEntry
{
public function __construct()
{
$this->createdAt = DateTimeUtility::createDateTimeUtc();
}
/**
* @var string
*
* @ORM\GeneratedValue(strategy="CUSTOM")
*
* @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
*
* @ORM\Column(name="id", type="guid")
*
* @ORM\Id
*/
private $id;
public function getId(): string
{
return $this->id;
}
/**
* @var User|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="mobileAppApiKeys")
*
* @ORM\JoinColumn(name="users_id", onDelete="CASCADE", nullable=true)
*/
protected $user;
public function setUser(?User $user): void
{
$this->user = $user;
}
public function getUser(): ?User
{
return $this->user;
}
/**
* @var ApiKey|null
*
* @ORM\ManyToOne(targetEntity="MobileAppApi\Entity\ApiKey")
*
* @ORM\JoinColumn(name="mobile_app_api_keys_id", onDelete="SET NULL", nullable=true)
*/
protected $apiKey;
public function setApiKey(?ApiKey $apiKey): void
{
$this->apiKey = $apiKey;
}
public function getApiKey(): ?ApiKey
{
return $this->apiKey;
}
/**
* @var string|null
*
* @ORM\Column(name="api_key_from_request", type="text", length=256, nullable=true)
*/
protected $apiKeyFromRequest;
public function setApiKeyFromRequest(?string $apiKeyFromRequest): void
{
$this->apiKeyFromRequest = $apiKeyFromRequest;
}
public function getApiKeyFromRequest(): ?string
{
return $this->apiKeyFromRequest;
}
/**
* @var DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
public function setCreatedAt(DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
/**
* @var bool
*
* @ORM\Column(name="resulted_in_exception", type="boolean", nullable=false)
*/
protected $resultedInException;
public function setResultedInException(bool $resultedInException): void
{
$this->resultedInException = $resultedInException;
}
public function getResultedInException(): bool
{
return $this->resultedInException;
}
/**
* @var string|null
*
* @ORM\Column(name="exception_message", type="text", length=66560, nullable=true)
*/
protected $exceptionMessage;
public function setExceptionMessage(?string $exceptionMessage): void
{
if (!is_null($exceptionMessage)) {
$this->exceptionMessage = mb_substr($exceptionMessage, 0, 4096);
}
}
public function getExceptionMessage(): ?string
{
return $this->exceptionMessage;
}
/**
* @var string
*
* @ORM\Column(name="request_method", type="string", length=32, nullable=false)
*/
protected $requestmethod;
public function setRequestmethod(string $requestmethod): void
{
$this->requestmethod = mb_substr($requestmethod, 0, 4096);
}
public function getRequestmethod(): string
{
return $this->requestmethod;
}
/**
* @var string
*
* @ORM\Column(name="request_uri", type="string", length=4096, nullable=false)
*/
protected $requestUri;
public function setRequestUri(string $requestUri): void
{
$this->requestUri = mb_substr($requestUri, 0, 4096);
}
public function getRequestUri(): string
{
return $this->requestUri;
}
/**
* @var string
*
* @ORM\Column(name="request_body", type="text", length=66560, nullable=false)
*/
protected $requestBody;
public function setRequestBody(string $requestBody): void
{
$this->requestBody = mb_substr($requestBody, 0, 16383);
}
public function getRequestBody(): string
{
return $this->requestBody;
}
/**
* @var int
*
* @ORM\Column(name="http_response_status_code", type="smallint", nullable=false)
*/
protected $httpResponseStatusCode;
public function setHttpResponseStatusCode(int $httpResponseStatusCode): void
{
$this->httpResponseStatusCode = $httpResponseStatusCode;
}
public function getHttpResponseStatusCode(): int
{
return $this->httpResponseStatusCode;
}
/**
* @var string|null
*
* @ORM\Column(name="response_body", type="text", length=66560, nullable=true)
*/
protected $responseBody;
public function setResponseBody(?string $responseBody): void
{
if (!is_null($responseBody)) {
$this->responseBody = mb_substr($responseBody, 0, 66560);
}
}
public function getResponseBody(): ?string
{
return $this->responseBody;
}
}