collection-crud/src/Repository/FlashRepository.php

31 lines
723 B
PHP

<?php declare(strict_types=1);
namespace App\Repository;
use App\Entity\{Flash, PreviouslyOwnedFlash};
use Doctrine\ORM\{ORMInvalidArgumentException};
class FlashRepository extends AcquireRepository
{
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedFlash());
}
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
$this->moveRecord($currentRecord, new Flash());
}
}