mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
main: add order field to civility
This commit is contained in:
parent
1fff9ef535
commit
b5178c3be3
@ -32,6 +32,11 @@ class Civility
|
|||||||
*/
|
*/
|
||||||
private bool $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="integer", nullable=true)
|
||||||
|
*/
|
||||||
|
private ?int $order = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
@ -62,6 +67,11 @@ class Civility
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOrder(): ?int
|
||||||
|
{
|
||||||
|
return $this->order;
|
||||||
|
}
|
||||||
|
|
||||||
public function getName(): ?array
|
public function getName(): ?array
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
@ -84,6 +94,13 @@ class Civility
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setOrder(int $order): self
|
||||||
|
{
|
||||||
|
$this->order = $order;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setName(array $name): self
|
public function setName(array $name): self
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Main;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add order to civility
|
||||||
|
*/
|
||||||
|
final class Version20211213112628 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add order to civility';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_civility ADD "order" INT DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_civility DROP "order"');
|
||||||
|
}
|
||||||
|
}
|
@ -197,7 +197,8 @@ class PersonType extends AbstractType
|
|||||||
},
|
},
|
||||||
'query_builder' => static function (EntityRepository $er): QueryBuilder {
|
'query_builder' => static function (EntityRepository $er): QueryBuilder {
|
||||||
return $er->createQueryBuilder('c')
|
return $er->createQueryBuilder('c')
|
||||||
->where('c.active = true');
|
->where('c.active = true')
|
||||||
|
->orderBy('c.order');
|
||||||
},
|
},
|
||||||
'placeholder' => 'choose civility',
|
'placeholder' => 'choose civility',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user