Moved getParts() and getPartsCount() to a repository (instead of a class method).

This commit is contained in:
Jan Böhmer 2020-05-16 20:53:35 +02:00
parent 350f1bb979
commit 14adb77a97
24 changed files with 421 additions and 71 deletions

View file

@ -43,6 +43,7 @@ declare(strict_types=1);
namespace App\Validator\Constraints;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Constraint;
@ -75,7 +76,8 @@ class ValidPartLotValidator extends ConstraintValidator
//We can only validate the values if we know the storelocation
if ($value->getStorageLocation()) {
$parts = $value->getStorageLocation()->getParts();
$repo = $this->em->getRepository(Storelocation::class);
$parts = $repo->getParts($value);
//Check for isFull() attribute
if ($value->getStorageLocation()->isFull()) {