diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 678084045..db56dbd94 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -222,6 +222,15 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface */ private ?string $name = ''; + /** + * @ORM\Column(name="firstname", type="string", length=255) + * @Assert\Length(min="2") + * @Assert\NotNull + * @Assert\NotBlank + * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) + */ + private ?string $firstname = ''; + /** * [fr] Raison sociale. * diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php index 2d33bbeb4..ef431f5ea 100644 --- a/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php +++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php @@ -39,15 +39,17 @@ final class Version20211007165001 extends AbstractMigration $this->addSql(" UPDATE chill_3party.third_party SET canonicalized = - UNACCENT( - LOWER( - name || - CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END || - COALESCE(name_company, '') || - CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END || - COALESCE(acronym, '') - ) - ) + UNACCENT( + LOWER( + name || + CASE WHEN COALESCE (firstname, '') <> '' THEN ' ' ELSE '' END || + COALESCE(firstname, '') || + CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END || + COALESCE(name_company, '') || + CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END || + COALESCE(acronym, '') + ) + ) "); $this->addSql(" CREATE OR REPLACE FUNCTION chill_3party.canonicalize() RETURNS TRIGGER diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20220311133150.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20220311133150.php new file mode 100644 index 000000000..f9475e932 --- /dev/null +++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20220311133150.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE chill_3party.third_party ADD firstname VARCHAR(255) DEFAULT \'""\' NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE chill_3party.third_party DROP firstname'); + } +}