<?php

declare(strict_types=1);

namespace Gls\GlsPoland\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Gls\GlsPoland\Entity\Parcel;

/**
 * @extends ServiceEntityRepository<Parcel>
 *
 * @deprecated since 1.1.0. Use {@see ConsignmentRepository} instead.
 */
class ParcelRepository extends EntityRepository
{
    public function add(Parcel $entity, bool $flush = true): void
    {
        $entityManager = $this->getEntityManager();
        $entityManager->persist($entity);
        if ($flush) {
            $entityManager->flush();
        }
    }

    public function remove(Parcel $entity, bool $flush = true): void
    {
        $entityManager = $this->getEntityManager();
        $entityManager->remove($entity);
        if ($flush) {
            $entityManager->flush();
        }
    }

    protected static function getEntityClass(): string
    {
        return Parcel::class;
    }
}
