2018-02-14 15:08:03 -05:00
|
|
|
<?php declare(strict_types=1);
|
2018-01-03 16:35:10 -05:00
|
|
|
|
2018-02-14 16:42:39 -05:00
|
|
|
namespace App\Repository;
|
2018-01-03 16:35:10 -05:00
|
|
|
|
2022-03-03 10:53:48 -05:00
|
|
|
use App\Entity\Camera;
|
|
|
|
use App\Entity\PreviouslyOwnedCamera;
|
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
|
|
use Doctrine\ORM\ORMInvalidArgumentException;
|
|
|
|
|
|
|
|
class CameraRepository extends EntityRepository
|
|
|
|
{
|
|
|
|
use AcquireTrait;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws ORMInvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function deacquire(Camera $currentRecord): void
|
|
|
|
{
|
|
|
|
$currentRecord->setFormerlyOwned(true)
|
|
|
|
->setReceived(true);
|
|
|
|
|
|
|
|
$this->moveRecord($currentRecord, new PreviouslyOwnedCamera());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws ORMInvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function reacquire(PreviouslyOwnedCamera $currentRecord): void
|
|
|
|
{
|
|
|
|
$currentRecord->setFormerlyOwned(false);
|
|
|
|
|
|
|
|
$this->moveRecord($currentRecord, new Camera());
|
|
|
|
}
|
2018-01-03 16:35:10 -05:00
|
|
|
}
|