firstname property added to thirdparty + canonicalize function adapted

This commit is contained in:
Julie Lenaerts 2022-03-14 09:35:22 +01:00
parent d6933fce35
commit 00787adf2b
3 changed files with 51 additions and 9 deletions

View File

@ -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.
*

View File

@ -42,6 +42,8 @@ final class Version20211007165001 extends AbstractMigration
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 ||

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220311133150 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adding firstname to thirdparty';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->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');
}
}