collection-crud/src/Repository/CameraRepository.php

30 lines
659 B
PHP
Raw Normal View History

2018-02-14 15:08:03 -05:00
<?php declare(strict_types=1);
namespace App\Repository;
2022-03-03 11:15:12 -05:00
use App\Entity\{Camera, PreviouslyOwnedCamera};
2022-09-30 10:48:14 -04:00
use Doctrine\ORM\{ORMInvalidArgumentException};
2022-03-03 10:53:48 -05:00
2023-07-21 10:35:15 -04:00
class CameraRepository extends AcquireRepository {
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
2022-03-03 10:53:48 -05:00
2023-07-21 10:35:15 -04:00
$this->moveRecord($currentRecord, new PreviouslyOwnedCamera());
}
2022-03-03 10:53:48 -05:00
2023-07-21 10:35:15 -04:00
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
2022-03-03 10:53:48 -05:00
2023-07-21 10:35:15 -04:00
$this->moveRecord($currentRecord, new Camera());
}
}