mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-08 12:15:02 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
eef26f7ae6
commit
639829f5c5
97 changed files with 305 additions and 185 deletions
|
@ -22,13 +22,14 @@ namespace App\Repository\Parts;
|
|||
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class CategoryRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof Category) {
|
||||
throw new \InvalidArgumentException('$element must be an Category!');
|
||||
throw new InvalidArgumentException('$element must be an Category!');
|
||||
}
|
||||
|
||||
return $this->getPartsByField($element, $order_by, 'category');
|
||||
|
@ -37,7 +38,7 @@ class CategoryRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Category) {
|
||||
throw new \InvalidArgumentException('$element must be an Category!');
|
||||
throw new InvalidArgumentException('$element must be an Category!');
|
||||
}
|
||||
|
||||
return $this->getPartsCountByField($element, 'category');
|
||||
|
|
|
@ -9,6 +9,7 @@ use App\Entity\Devices\Device;
|
|||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class DeviceRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ class DeviceRepository extends AbstractPartsContainingRepository
|
|||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof Device) {
|
||||
throw new \InvalidArgumentException('$element must be an Device!');
|
||||
throw new InvalidArgumentException('$element must be an Device!');
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,7 +28,7 @@ class DeviceRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Device) {
|
||||
throw new \InvalidArgumentException('$element must be an Device!');
|
||||
throw new InvalidArgumentException('$element must be an Device!');
|
||||
}
|
||||
|
||||
//TODO: Change this later, when properly implemented devices
|
||||
|
|
|
@ -22,13 +22,14 @@ namespace App\Repository\Parts;
|
|||
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class FootprintRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof Footprint) {
|
||||
throw new \InvalidArgumentException('$element must be an Footprint!');
|
||||
throw new InvalidArgumentException('$element must be an Footprint!');
|
||||
}
|
||||
|
||||
return $this->getPartsByField($element, $order_by, 'footprint');
|
||||
|
@ -37,7 +38,7 @@ class FootprintRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Footprint) {
|
||||
throw new \InvalidArgumentException('$element must be an Footprint!');
|
||||
throw new InvalidArgumentException('$element must be an Footprint!');
|
||||
}
|
||||
|
||||
return $this->getPartsCountByField($element, 'footprint');
|
||||
|
|
|
@ -22,13 +22,14 @@ namespace App\Repository\Parts;
|
|||
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class ManufacturerRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof Manufacturer) {
|
||||
throw new \InvalidArgumentException('$element must be an Manufacturer!');
|
||||
throw new InvalidArgumentException('$element must be an Manufacturer!');
|
||||
}
|
||||
|
||||
return $this->getPartsByField($element, $order_by, 'manufacturer');
|
||||
|
@ -37,7 +38,7 @@ class ManufacturerRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Manufacturer) {
|
||||
throw new \InvalidArgumentException('$element must be an Manufacturer!');
|
||||
throw new InvalidArgumentException('$element must be an Manufacturer!');
|
||||
}
|
||||
|
||||
return $this->getPartsCountByField($element, 'manufacturer');
|
||||
|
|
|
@ -22,13 +22,14 @@ namespace App\Repository\Parts;
|
|||
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class MeasurementUnitRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof MeasurementUnit) {
|
||||
throw new \InvalidArgumentException('$element must be an MeasurementUnit!');
|
||||
throw new InvalidArgumentException('$element must be an MeasurementUnit!');
|
||||
}
|
||||
|
||||
return $this->getPartsByField($element, $order_by, 'partUnit');
|
||||
|
@ -37,7 +38,7 @@ class MeasurementUnitRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof MeasurementUnit) {
|
||||
throw new \InvalidArgumentException('$element must be an MeasurementUnit!');
|
||||
throw new InvalidArgumentException('$element must be an MeasurementUnit!');
|
||||
}
|
||||
|
||||
return $this->getPartsCountByField($element, 'partUnit');
|
||||
|
|
|
@ -24,6 +24,7 @@ use App\Entity\Parts\Part;
|
|||
use App\Entity\Parts\Storelocation;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class StorelocationRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
|
@ -33,7 +34,7 @@ class StorelocationRepository extends AbstractPartsContainingRepository
|
|||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof Storelocation) {
|
||||
throw new \InvalidArgumentException('$element must be an Storelocation!');
|
||||
throw new InvalidArgumentException('$element must be an Storelocation!');
|
||||
}
|
||||
|
||||
$qb = new QueryBuilder($this->getEntityManager());
|
||||
|
@ -54,7 +55,7 @@ class StorelocationRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Storelocation) {
|
||||
throw new \InvalidArgumentException('$element must be an Storelocation!');
|
||||
throw new InvalidArgumentException('$element must be an Storelocation!');
|
||||
}
|
||||
|
||||
$qb = new QueryBuilder($this->getEntityManager());
|
||||
|
|
|
@ -24,13 +24,14 @@ use App\Entity\Parts\Part;
|
|||
use App\Entity\Parts\Supplier;
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class SupplierRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
if (!$element instanceof Supplier) {
|
||||
throw new \InvalidArgumentException('$element must be an Supplier!');
|
||||
throw new InvalidArgumentException('$element must be an Supplier!');
|
||||
}
|
||||
|
||||
$qb = new QueryBuilder($this->getEntityManager());
|
||||
|
@ -51,7 +52,7 @@ class SupplierRepository extends AbstractPartsContainingRepository
|
|||
public function getPartsCount(object $element): int
|
||||
{
|
||||
if (!$element instanceof Supplier) {
|
||||
throw new \InvalidArgumentException('$element must be an Supplier!');
|
||||
throw new InvalidArgumentException('$element must be an Supplier!');
|
||||
}
|
||||
|
||||
$qb = new QueryBuilder($this->getEntityManager());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue