diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index 48b2a7569..3b832aede 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -32,6 +32,11 @@ class Civility */ private bool $active = true; + /** + * @ORM\Column(type="integer", nullable=true) + */ + private ?int $order = null; + /** * @ORM\Id * @ORM\GeneratedValue @@ -62,6 +67,11 @@ class Civility return $this->id; } + public function getOrder(): ?int + { + return $this->order; + } + public function getName(): ?array { return $this->name; @@ -84,6 +94,13 @@ class Civility return $this; } + public function setOrder(int $order): self + { + $this->order = $order; + + return $this; + } + public function setName(array $name): self { $this->name = $name; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20211213112628.php b/src/Bundle/ChillMainBundle/migrations/Version20211213112628.php new file mode 100644 index 000000000..905a24048 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20211213112628.php @@ -0,0 +1,29 @@ +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"'); + } +} diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 47baafe2b..99382dec2 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -197,7 +197,8 @@ class PersonType extends AbstractType }, 'query_builder' => static function (EntityRepository $er): QueryBuilder { return $er->createQueryBuilder('c') - ->where('c.active = true'); + ->where('c.active = true') + ->orderBy('c.order'); }, 'placeholder' => 'choose civility', 'required' => false,