<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Controller\Api\AskForMatchProfileController;
use App\Controller\Api\CheckMatchProfileController;
use App\Repository\MatchProfileRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: MatchProfileRepository::class)]
/*#[ApiResource(
normalizationContext: ['groups' => ['profile']],
denormalizationContext: ['groups' => ['profile','post']],
collectionOperations: [
'get',
'post',
'askformatch'=> [
'method' => 'POST',
'path' => '/ask-for-match',
'controller' => AskForMatchProfileController::class,
],
],
)]*/
class MatchProfile
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(nullable: true)]
#[Groups("profile")]
private ?bool $isMatchAccepted = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups("profile")]
private ?\DateTimeInterface $askForMatchAt = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
#[Groups("profile")]
private ?\DateTimeInterface $ignoreMatchAt = null;
#[ORM\ManyToOne(inversedBy: 'askedMatches')]
#[Groups("post")]
private ?Profile $profileAskForMatch = null;
#[ORM\ManyToOne(inversedBy: 'matchesByOthers')]
#[Groups("post")]
private ?Profile $profileMatched = null;
#[ORM\Column(nullable: true)]
#[Groups("profile")]
private ?bool $isIgnored = null;
public function getId(): ?int
{
return $this->id;
}
public function getIsMatchAccepted(): ?bool
{
return $this->isMatchAccepted;
}
public function setIsMatchAccepted(?bool $isMatchAccepted): self
{
$this->isMatchAccepted = $isMatchAccepted;
return $this;
}
public function getAskForMatchAt(): ?\DateTimeInterface
{
return $this->askForMatchAt;
}
public function setAskForMatchAt(?\DateTimeInterface $askForMatchAt): self
{
$this->askForMatchAt = $askForMatchAt;
return $this;
}
public function getIgnoreMatchAt(): ?\DateTimeInterface
{
return $this->ignoreMatchAt;
}
public function setIgnoreMatchAt(?\DateTimeInterface $ignoreMatchAt): self
{
$this->ignoreMatchAt = $ignoreMatchAt;
return $this;
}
public function getProfileAskForMatch(): ?Profile
{
return $this->profileAskForMatch;
}
public function setProfileAskForMatch(?Profile $profileAskForMatch): self
{
$this->profileAskForMatch = $profileAskForMatch;
return $this;
}
public function getProfileMatched(): ?Profile
{
return $this->profileMatched;
}
public function setProfileMatched(?Profile $profileMatched): self
{
$this->profileMatched = $profileMatched;
return $this;
}
public function getIsIgnored(): ?bool
{
return $this->isIgnored;
}
public function setIsIgnored(?bool $isIgnored): self
{
$this->isIgnored = $isIgnored;
return $this;
}
}