Fix Licences withdrawals

This commit is contained in:
Xbird
2022-04-29 14:30:04 +00:00
parent 4ce623e948
commit e8f61fcccc
15 changed files with 90 additions and 71 deletions

View File

@@ -5,7 +5,6 @@ namespace App\Command;
use App\Entity\Group;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Attribute\AsCommand;

View File

@@ -76,7 +76,7 @@ class DirectoryController extends AbstractController
$DocumentList = [
'Certificate',
'Complaint',
'LicenceWithdrawal',
'Licencewithdrawal',
'Infringement',
'Jail',
'Bracelet',

View File

@@ -356,10 +356,10 @@ class Directory
private $complaints;
/**
* @ORM\OneToMany(targetEntity=LicenceWithdrawal::class, mappedBy="directory", orphanRemoval=true)
* @ORM\OneToMany(targetEntity=Licencewithdrawal::class, mappedBy="directory", orphanRemoval=true)
* @ORM\OrderBy({"createdAt" = "DESC"})
*/
private $licenceWithdrawals;
private $licencewithdrawals;
/**
* @ORM\Column(type="text", nullable=true)
@@ -477,7 +477,7 @@ class Directory
$this->bracelets = new ArrayCollection();
$this->criminals = new ArrayCollection();
$this->complaints = new ArrayCollection();
$this->licenceWithdrawals = new ArrayCollection();
$this->licencewithdrawals = new ArrayCollection();
$this->infringements = new ArrayCollection();
$this->folders = new ArrayCollection();
}
@@ -1183,29 +1183,29 @@ class Directory
}
/**
* @return Collection|LicenceWithdrawal[]
* @return Collection|Licencewithdrawal[]
*/
public function getLicenceWithdrawals(): Collection
public function getLicencewithdrawals(): Collection
{
return $this->licenceWithdrawals;
return $this->licencewithdrawals;
}
public function addLicenceWithdrawal(LicenceWithdrawal $licenceWithdrawal): self
public function addLicencewithdrawal(Licencewithdrawal $licencewithdrawal): self
{
if (!$this->licenceWithdrawals->contains($licenceWithdrawal)) {
$this->licenceWithdrawals[] = $licenceWithdrawal;
$licenceWithdrawal->setDirectory($this);
if (!$this->licencewithdrawals->contains($licencewithdrawal)) {
$this->licencewithdrawals[] = $licencewithdrawal;
$licencewithdrawal->setDirectory($this);
}
return $this;
}
public function removeLicenceWithdrawal(LicenceWithdrawal $licenceWithdrawal): self
public function removeLicencewithdrawal(Licencewithdrawal $licencewithdrawal): self
{
if ($this->licenceWithdrawals->removeElement($licenceWithdrawal)) {
if ($this->licencewithdrawals->removeElement($licencewithdrawal)) {
// set the owning side to null (unless already changed)
if ($licenceWithdrawal->getDirectory() === $this) {
$licenceWithdrawal->setDirectory(null);
if ($licencewithdrawal->getDirectory() === $this) {
$licencewithdrawal->setDirectory(null);
}
}

View File

@@ -2,16 +2,18 @@
namespace App\Entity;
use App\Entity\User;
use DateTimeImmutable;
use App\Entity\Document;
use App\Entity\Directory;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Repository\LicenceWithdrawalRepository;
use App\Repository\LicencewithdrawalRepository;
/**
* @ORM\Entity(repositoryClass=LicenceWithdrawalRepository::class)
* @ORM\Entity(repositoryClass=LicencewithdrawalRepository::class)
*/
class LicenceWithdrawal extends Document
class Licencewithdrawal extends Document
{
/**
* @ORM\Column(type="string", length=255)
@@ -26,7 +28,7 @@ class LicenceWithdrawal extends Document
private $until;
/**
* @ORM\ManyToOne(targetEntity=Directory::class, inversedBy="licenceWithdrawals")
* @ORM\ManyToOne(targetEntity=Directory::class, inversedBy="licencewithdrawals")
* @ORM\JoinColumn(nullable=false)
*/
private $directory;

View File

@@ -4,7 +4,7 @@ namespace App\Form;
use App\Form\DocumentType;
use App\Form\Type\VehicleType;
use App\Entity\LicenceWithdrawal;
use App\Entity\Licencewithdrawal;
use App\Form\Type\DateTimeVisionType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -30,7 +30,7 @@ class LicencewithdrawalType extends DocumentType
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => LicenceWithdrawal::class,
'data_class' => Licencewithdrawal::class,
]);
}
}

View File

@@ -1,22 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\LicenceWithdrawal;
use Doctrine\Persistence\ManagerRegistry;
use App\Repository\Tools\DocumentRepositoriesExtension;
/**
* @method LicenceWithdrawal|null find($id, $lockMode = null, $lockVersion = null)
* @method LicenceWithdrawal|null findOneBy(array $criteria, array $orderBy = null)
* @method LicenceWithdrawal[] findAll()
* @method LicenceWithdrawal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class LicenceWithdrawalRepository extends DocumentRepositoriesExtension
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, LicenceWithdrawal::class);
$this->fields = ['type']; //with title, list fields we can search in
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Repository;
use App\Entity\Licencewithdrawal;
use Doctrine\Persistence\ManagerRegistry;
use App\Repository\Tools\DocumentRepositoriesExtension;
/**
* @method Licencewithdrawal|null find($id, $lockMode = null, $lockVersion = null)
* @method Licencewithdrawal|null findOneBy(array $criteria, array $orderBy = null)
* @method Licencewithdrawal[] findAll()
* @method Licencewithdrawal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class LicencewithdrawalRepository extends DocumentRepositoriesExtension
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Licencewithdrawal::class);
$this->fields = ['type']; //with title, list fields we can search in
}
}