mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
firstname property added to thirdparty + canonicalize function adapted
This commit is contained in:
parent
d6933fce35
commit
00787adf2b
@ -222,6 +222,15 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*/
|
*/
|
||||||
private ?string $name = '';
|
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.
|
* [fr] Raison sociale.
|
||||||
*
|
*
|
||||||
|
@ -39,15 +39,17 @@ final class Version20211007165001 extends AbstractMigration
|
|||||||
$this->addSql("
|
$this->addSql("
|
||||||
UPDATE chill_3party.third_party
|
UPDATE chill_3party.third_party
|
||||||
SET canonicalized =
|
SET canonicalized =
|
||||||
UNACCENT(
|
UNACCENT(
|
||||||
LOWER(
|
LOWER(
|
||||||
name ||
|
name ||
|
||||||
CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END ||
|
CASE WHEN COALESCE (firstname, '') <> '' THEN ' ' ELSE '' END ||
|
||||||
COALESCE(name_company, '') ||
|
COALESCE(firstname, '') ||
|
||||||
CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END ||
|
CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END ||
|
||||||
COALESCE(acronym, '')
|
COALESCE(name_company, '') ||
|
||||||
)
|
CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END ||
|
||||||
)
|
COALESCE(acronym, '')
|
||||||
|
)
|
||||||
|
)
|
||||||
");
|
");
|
||||||
$this->addSql("
|
$this->addSql("
|
||||||
CREATE OR REPLACE FUNCTION chill_3party.canonicalize() RETURNS TRIGGER
|
CREATE OR REPLACE FUNCTION chill_3party.canonicalize() RETURNS TRIGGER
|
||||||
|
@ -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');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user