add authentication
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Marko
2023-11-10 16:54:07 +01:00
parent 9c2e2b6ade
commit 8554cf714d
28 changed files with 699 additions and 774 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Repository;
use App\Entity\Order;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Exception;
/**
* @extends ServiceEntityRepository<Order>
@@ -39,6 +40,22 @@ class OrderRepository extends ServiceEntityRepository
}
}
/**
* @throws Exception
*/
public function update(Order $entity, bool $flush = false): void
{
$order = $this->getEntityManager()->find(Order::class, $entity->getId());
if (!$order) {
throw $this->createNotFoundException('Order not found: ' . $entity->getId());
}
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Order[] Returns an array of Order objects
// */
@@ -63,4 +80,11 @@ class OrderRepository extends ServiceEntityRepository
// ->getOneOrNullResult()
// ;
// }
}
/**
* @throws Exception
*/
private function createNotFoundException(string $string)
{
throw new Exception($string);
}
}