2
This commit is contained in:
@@ -7,7 +7,6 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Orders>
|
||||
*
|
||||
@@ -20,7 +19,7 @@ class OrdersRepository extends ServiceEntityRepository
|
||||
{
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
public function __construct(ManagerRegistry $registry,ValidatorInterface $validator)
|
||||
public function __construct(ManagerRegistry $registry, ValidatorInterface $validator)
|
||||
{
|
||||
parent::__construct($registry, Orders::class);
|
||||
$this->validator = $validator;
|
||||
@@ -30,7 +29,7 @@ class OrdersRepository extends ServiceEntityRepository
|
||||
|
||||
$errors = $this->validator->validate($entity);
|
||||
if (count($errors) > 0) {
|
||||
var_dump($errors);
|
||||
var_dump($errors);
|
||||
}
|
||||
|
||||
$this->getEntityManager()->persist($entity);
|
||||
@@ -44,10 +43,9 @@ class OrdersRepository extends ServiceEntityRepository
|
||||
{
|
||||
$order = $this->getEntityManager()->find(Orders::class, $entity->getId());
|
||||
|
||||
if(!$order) {
|
||||
if (!$order) {
|
||||
throw $this->createNotFoundException('Order not found: '.$entity->getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function remove(Orders $entity, bool $flush = false): void
|
||||
|
||||
Reference in New Issue
Block a user