<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\ContactsRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
#[ORM\Entity(repositoryClass: ContactsRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['contacts:read']],
denormalizationContext: ['groups' => ['contacts:write']],
order: ['id' => 'DESC'],
)]
#[ApiFilter(SearchFilter::class, properties: [
'account.id' => 'exact',
'type' => 'exact',
'typeList' => 'exact'
])]
class Contacts
{
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_entered = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date_modified = null;
#[ORM\ManyToOne]
private ?User $created_by = null;
#[ORM\ManyToOne]
private ?User $modified_user = null;
#[Groups(['contacts:read', 'contacts:write'])]
#[ORM\ManyToOne(inversedBy: 'contacts')]
private ?Accounts $account = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 20, nullable: true)]
private ?string $phone = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $email = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $value = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $country = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $region = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $city = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $address = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 20)]
private ?string $code1c = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $type = null;
#[Groups(['account:read', 'contacts:read', 'contacts:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $typeList = null;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getDateEntered(): ?\DateTimeInterface
{
return $this->date_entered;
}
public function setDateEntered(?\DateTimeInterface $date_entered): self
{
$this->date_entered = $date_entered;
return $this;
}
public function getDateModified(): ?\DateTimeInterface
{
return $this->date_modified;
}
public function setDateModified(?\DateTimeInterface $date_modified): self
{
$this->date_modified = $date_modified;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->created_by;
}
public function setCreatedBy(?User $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getModifiedUser(): ?User
{
return $this->modified_user;
}
public function setModifiedUser(?User $modified_user): self
{
$this->modified_user = $modified_user;
return $this;
}
public function getAccount(): ?Accounts
{
return $this->account;
}
public function setAccount(?Accounts $account): self
{
$this->account = $account;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(?string $value): self
{
$this->value = $value;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
public function getRegion(): ?string
{
return $this->region;
}
public function setRegion(?string $region): self
{
$this->region = $region;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getCode1c(): ?string
{
return $this->code1c;
}
public function setCode1c(string $code1c): self
{
$this->code1c = $code1c;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getTypeList(): ?string
{
return $this->typeList;
}
public function setTypeList(?string $typeList): self
{
$this->typeList = $typeList;
return $this;
}
}