Wanted Card + Fixs

This commit is contained in:
Xbird
2022-08-13 14:31:30 +00:00
parent c493e6ac5a
commit 96a233e706
12 changed files with 83 additions and 6 deletions

View File

@@ -29,7 +29,7 @@ class HomeController extends AbstractController
->order(['createdAt' => 'DESC'])
->getResult(),
'wanted' =>
$DirectoryRepository->list()->notDead()->wanted()->getResult(),
$DirectoryRepository->list()->notDead()->wanted()->wantedDisplay()->getResult(),
'controller_name' => 'HomeController',
]);
}

View File

@@ -415,6 +415,11 @@ class Directory
*/
private $wantedReason;
/**
* @ORM\Column(type="boolean", options={"default":"1"})
*/
private $wantedDisplay = true;
/**
* @ORM\OneToMany(targetEntity=Infringement::class, mappedBy="directory", orphanRemoval=true)
* @ORM\OrderBy({"createdAt" = "DESC"})
@@ -1335,6 +1340,18 @@ class Directory
return $this;
}
public function getWantedDisplay(): ?bool
{
return $this->wantedDisplay;
}
public function setWantedDisplay(bool $wantedDisplay): self
{
$this->wantedDisplay = $wantedDisplay;
return $this;
}
/**
* @return Collection|Infringement[]
*/

View File

@@ -67,6 +67,7 @@ class DirectoryType extends AbstractType
->add('gangInfo', null, ['label' => 'form_label_gang_info'])
->add('wanted', null, ['label' => 'form_label_wanted'])
->add('wantedReason', null, ['label' => 'form_label_wantedReason', 'help' => 'form_help_wantedReason'])
->add('wantedDisplay', null, ['label' => 'form_label_wantedDisplay'])
;
}

View File

@@ -77,6 +77,18 @@ class DirectoryRepository extends ServiceEntityRepository
return $this;
}
public function wantedDisplay()
{
$this->qb->andWhere('d.wantedDisplay = 1');
return $this;
}
public function wantedNotDisplay()
{
$this->qb->andWhere('d.wantedDisplay = 0');
return $this;
}
public function order(array $order)
{
foreach ($order as $key => $value) {