collection-crud/src/Repository/FlashRepository.php

33 lines
778 B
PHP
Raw Normal View History

2018-02-14 15:08:03 -05:00
<?php declare(strict_types=1);
namespace App\Repository;
2018-02-14 15:08:03 -05:00
2022-03-03 11:15:12 -05:00
use App\Entity\{Flash, PreviouslyOwnedFlash};
use Doctrine\ORM\{EntityRepository, ORMInvalidArgumentException};
2022-03-03 10:53:48 -05:00
class FlashRepository extends EntityRepository
{
use AcquireTrait;
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(Flash $currentRecord): void
{
2022-03-03 11:15:12 -05:00
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
2022-03-03 10:53:48 -05:00
$this->moveRecord($currentRecord, new PreviouslyOwnedFlash());
}
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(PreviouslyOwnedFlash $currentRecord): void
{
2022-03-03 11:15:12 -05:00
$currentRecord->setFormerlyOwned(FALSE);
2022-03-03 10:53:48 -05:00
$this->moveRecord($currentRecord, new Flash());
}
2018-02-14 15:08:03 -05:00
}