feat: entité CustomerContact pour contacts additionnels d'un client

Entity CustomerContact :
- customer (ManyToOne, CASCADE) : client parent
- firstName, lastName : nom/prénom du contact
- email : adresse email (nullable)
- phone : téléphone (nullable)
- role : fonction dans l'entreprise (Gérant, Comptable, etc.)
- isBillingEmail : si true, reçoit les factures par email
- createdAt / updatedAt : timestamps
- getFullName() : prénom + nom

CustomerContactTest (2 tests, 19 assertions) :
- testConstructor : valeurs par défaut
- testSetters : tous les setters/getters

Migration : CREATE TABLE customer_contact avec FK customer ON DELETE CASCADE

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-04-04 11:13:33 +02:00
parent 5369682f35
commit 7ae63dd996
3 changed files with 256 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260404091315 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE customer_contact (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, role VARCHAR(100) DEFAULT NULL, is_billing_email BOOLEAN NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, customer_id INT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_50BF42869395C3F3 ON customer_contact (customer_id)');
$this->addSql('ALTER TABLE customer_contact ADD CONSTRAINT FK_50BF42869395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customer_contact DROP CONSTRAINT FK_50BF42869395C3F3');
$this->addSql('DROP TABLE customer_contact');
}
}