add hiltes log on Order
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Order;
|
||||
use DateTime;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Exception;
|
||||
@@ -24,6 +25,7 @@ class OrderRepository extends ServiceEntityRepository
|
||||
|
||||
public function save(Order $entity, bool $flush = false): void
|
||||
{
|
||||
$entity->setChangeDate(new DateTime());
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
@@ -46,6 +48,7 @@ class OrderRepository extends ServiceEntityRepository
|
||||
public function update(Order $entity, bool $flush = false): void
|
||||
{
|
||||
$order = $this->getEntityManager()->find(Order::class, $entity->getId());
|
||||
$order->setChangeDate(new DateTime());
|
||||
|
||||
if (!$order) {
|
||||
throw $this->createNotFoundException('Order not found: ' . $entity->getId());
|
||||
|
||||
Reference in New Issue
Block a user