feat(directory) : add contact/address/report tables, migrate inline addresses, drop inline columns

This commit is contained in:
Matthieu
2026-06-22 12:11:11 +02:00
parent 33ba90a00d
commit 354d7c34ba
12 changed files with 279 additions and 167 deletions
@@ -58,18 +58,6 @@ class Client implements ClientInterface, TimestampableInterface, BlamableInterfa
#[Groups(['client:read', 'client:write'])]
private ?string $phone = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['client:read', 'client:write'])]
private ?string $street = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['client:read', 'client:write'])]
private ?string $city = null;
#[ORM\Column(length: 20, nullable: true)]
#[Groups(['client:read', 'client:write'])]
private ?string $postalCode = null;
/** @var Collection<int, ProjectInterface> */
#[ORM\OneToMany(targetEntity: ProjectInterface::class, mappedBy: 'client')]
private Collection $projects;
@@ -120,42 +108,6 @@ class Client implements ClientInterface, TimestampableInterface, BlamableInterfa
return $this;
}
public function getStreet(): ?string
{
return $this->street;
}
public function setStreet(?string $street): static
{
$this->street = $street;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): static
{
$this->city = $city;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): static
{
$this->postalCode = $postalCode;
return $this;
}
/** @return Collection<int, ProjectInterface> */
public function getProjects(): Collection
{
@@ -71,18 +71,6 @@ class Prospect implements TimestampableInterface, BlamableInterface
#[Groups(['prospect:read', 'prospect:write'])]
private ?string $phone = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['prospect:read', 'prospect:write'])]
private ?string $street = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['prospect:read', 'prospect:write'])]
private ?string $city = null;
#[ORM\Column(length: 20, nullable: true)]
#[Groups(['prospect:read', 'prospect:write'])]
private ?string $postalCode = null;
#[ORM\Column(type: Types::STRING, length: 32, enumType: ProspectStatus::class)]
#[Groups(['prospect:read', 'prospect:write'])]
private ProspectStatus $status = ProspectStatus::New;
@@ -153,42 +141,6 @@ class Prospect implements TimestampableInterface, BlamableInterface
return $this;
}
public function getStreet(): ?string
{
return $this->street;
}
public function setStreet(?string $street): static
{
$this->street = $street;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): static
{
$this->city = $city;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(?string $postalCode): static
{
$this->postalCode = $postalCode;
return $this;
}
public function getStatus(): ProspectStatus
{
return $this->status;
@@ -47,9 +47,6 @@ final readonly class ConvertProspectProcessor implements ProcessorInterface
$client->setName($prospect->getCompany() ?: (string) $prospect->getName());
$client->setEmail($prospect->getEmail());
$client->setPhone($prospect->getPhone());
$client->setStreet($prospect->getStreet());
$client->setCity($prospect->getCity());
$client->setPostalCode($prospect->getPostalCode());
$this->entityManager->persist($client);
@@ -41,9 +41,6 @@ class ConvertProspectTool
$client->setName($prospect->getCompany() ?: (string) $prospect->getName());
$client->setEmail($prospect->getEmail());
$client->setPhone($prospect->getPhone());
$client->setStreet($prospect->getStreet());
$client->setCity($prospect->getCity());
$client->setPostalCode($prospect->getPostalCode());
$this->entityManager->persist($client);
@@ -23,9 +23,6 @@ class CreateClientTool
string $name,
?string $email = null,
?string $phone = null,
?string $street = null,
?string $city = null,
?string $postalCode = null,
): string {
if (!$this->security->isGranted('ROLE_ADMIN')) {
throw new AccessDeniedException('Access denied: ROLE_ADMIN required.');
@@ -35,9 +32,6 @@ class CreateClientTool
$client->setName($name);
$client->setEmail($email);
$client->setPhone($phone);
$client->setStreet($street);
$client->setCity($city);
$client->setPostalCode($postalCode);
$this->entityManager->persist($client);
$this->entityManager->flush();
@@ -28,9 +28,6 @@ class CreateProspectTool
?string $company = null,
?string $email = null,
?string $phone = null,
?string $street = null,
?string $city = null,
?string $postalCode = null,
?string $status = null,
?string $source = null,
?string $notes = null,
@@ -44,9 +41,6 @@ class CreateProspectTool
$prospect->setCompany($company);
$prospect->setEmail($email);
$prospect->setPhone($phone);
$prospect->setStreet($street);
$prospect->setCity($city);
$prospect->setPostalCode($postalCode);
$prospect->setSource($source);
$prospect->setNotes($notes);
@@ -28,9 +28,6 @@ class UpdateClientTool
?string $name = null,
?string $email = null,
?string $phone = null,
?string $street = null,
?string $city = null,
?string $postalCode = null,
): string {
if (!$this->security->isGranted('ROLE_ADMIN')) {
throw new AccessDeniedException('Access denied: ROLE_ADMIN required.');
@@ -50,15 +47,6 @@ class UpdateClientTool
if (null !== $phone) {
$client->setPhone($phone);
}
if (null !== $street) {
$client->setStreet($street);
}
if (null !== $city) {
$client->setCity($city);
}
if (null !== $postalCode) {
$client->setPostalCode($postalCode);
}
$this->entityManager->flush();
@@ -30,9 +30,6 @@ class UpdateProspectTool
?string $company = null,
?string $email = null,
?string $phone = null,
?string $street = null,
?string $city = null,
?string $postalCode = null,
?string $status = null,
?string $source = null,
?string $notes = null,
@@ -58,15 +55,6 @@ class UpdateProspectTool
if (null !== $phone) {
$prospect->setPhone($phone);
}
if (null !== $street) {
$prospect->setStreet($street);
}
if (null !== $city) {
$prospect->setCity($city);
}
if (null !== $postalCode) {
$prospect->setPostalCode($postalCode);
}
if (null !== $status) {
$statusEnum = ProspectStatus::tryFrom($status);
if (null === $statusEnum) {