Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions sources/AppBundle/Accounting/Entity/Payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace AppBundle\Accounting\Entity;

use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'compta_reglement')]
class Payment
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
public ?int $id = null;

#[ORM\Column(name: 'reglement', length: 50, nullable: false)]
public string $name;

#[ORM\Column(type: 'datetime_immutable', nullable: true)]
public ?\DateTimeImmutable $hideInAccountingJournalAt = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace AppBundle\Accounting\Entity\Repository;

use AppBundle\Accounting\Entity\Payment;
use AppBundle\Doctrine\EntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
* @extends EntityRepository<Payment>
*/
final class PaymentRepository extends EntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Payment::class);
}

/**
* @return array<Payment>
*/
public function getAllSortedByName(): array
{
return $this->createQueryBuilder('p')
->orderBy('p.name', 'asc')
->getQuery()
->execute();
}
}
55 changes: 0 additions & 55 deletions sources/AppBundle/Accounting/Model/Payment.php

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace AppBundle\Controller\Admin\Accounting\Configuration;

use AppBundle\Accounting\Form\PaymentType;
use AppBundle\Accounting\Model\Payment;
use AppBundle\Accounting\Model\Repository\PaymentRepository;
use AppBundle\Accounting\Entity\Payment;
use AppBundle\Accounting\Entity\Repository\PaymentRepository;
use AppBundle\AuditLog\Audit;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -26,7 +26,7 @@ public function __invoke(Request $request): Response
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->paymentRepository->save($payment);
$this->audit->log('Ajout du type de règlement ' . $payment->getName());
$this->audit->log('Ajout du type de règlement ' . $payment->name);
$this->addFlash('notice', 'Le type de règlement a été ajouté');
return $this->redirectToRoute('admin_accounting_payments_list');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace AppBundle\Controller\Admin\Accounting\Configuration;

use AppBundle\Accounting\Form\PaymentType;
use AppBundle\Accounting\Model\Repository\PaymentRepository;
use AppBundle\Accounting\Entity\Repository\PaymentRepository;
use AppBundle\AuditLog\Audit;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -20,12 +20,12 @@ public function __construct(

public function __invoke(int $id,Request $request): Response
{
$payment = $this->paymentRepository->get($id);
$payment = $this->paymentRepository->find($id);
$form = $this->createForm(PaymentType::class, $payment);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->paymentRepository->save($payment);
$this->audit->log('Modification du type de règlement ' . $payment->getName());
$this->audit->log('Modification du type de règlement ' . $payment->name);
$this->addFlash('notice', 'Le type de règlement a été modifié');
return $this->redirectToRoute('admin_accounting_payments_list');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace AppBundle\Controller\Admin\Accounting\Configuration;

use AppBundle\Accounting\Model\Repository\PaymentRepository;
use AppBundle\Accounting\Entity\Repository\PaymentRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
Expand Down
Loading