33 lines
785 B
PHP
33 lines
785 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Repository;
|
|
|
|
use App\Entity\{Camera, PreviouslyOwnedCamera};
|
|
use Doctrine\ORM\{EntityRepository, 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());
|
|
}
|
|
}
|