<?php
namespace App\Entity\Account;
use App\Entity\App\App;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\JoinColumn;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampInterface;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampTrait;
#[
ORM\Entity(),
ORM\Table('account_sso_app_session'),
ORM\Index(columns: ['user_id', 'app_id']),
ORM\Index(columns: ['session_id']),
ORM\UniqueConstraint(columns: ['app_id', 'session_id']),
]
class SsoAppSession implements CreatedTimestampInterface
{
use CreatedTimestampTrait;
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer', nullable: false)]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')]
#[JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?User $user = null;
#[ORM\ManyToOne(targetEntity: App::class, fetch: 'EAGER')]
#[JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?App $app = null;
#[ORM\Column(type: 'string', length: 255, nullable: false)]
private ?string $sessionId = null;
#[ORM\Column(type: 'string', length: 64, nullable: false)]
private ?string $deviceId = null;
#[ORM\Column(type: 'text', nullable: false)]
private ?String $userAgent = null;
#[ORM\Column(type: 'string', length: 45, nullable: false)]
private ?string $ipAddress = null;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private ?\DateTimeImmutable $revokedAt = null;
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): SsoAppSession
{
$this->user = $user;
return $this;
}
public function getApp(): ?App
{
return $this->app;
}
public function setApp(?App $app): SsoAppSession
{
$this->app = $app;
return $this;
}
public function getSessionId(): ?string
{
return $this->sessionId;
}
public function setSessionId(?string $sessionId): SsoAppSession
{
$this->sessionId = $sessionId;
return $this;
}
public function getDeviceId(): ?string
{
return $this->deviceId;
}
public function setDeviceId(?string $deviceId): SsoAppSession
{
$this->deviceId = $deviceId;
return $this;
}
public function getUserAgent(): ?string
{
return $this->userAgent;
}
public function setUserAgent(?string $userAgent): SsoAppSession
{
$this->userAgent = $userAgent;
return $this;
}
public function getIpAddress(): ?string
{
return $this->ipAddress;
}
public function setIpAddress(?string $ipAddress): SsoAppSession
{
$this->ipAddress = $ipAddress;
return $this;
}
public function getRevokedAt(): ?\DateTimeImmutable
{
return $this->revokedAt;
}
public function setRevokedAt(?\DateTimeImmutable $revokedAt): SsoAppSession
{
$this->revokedAt = $revokedAt;
return $this;
}
}