collection-crud/src/Repository/LensesRepository.php

28 lines
649 B
PHP
Raw Normal View History

2018-07-18 11:35:27 -04:00
<?php declare(strict_types=1);
2018-01-04 10:42:36 -05:00
namespace App\Repository;
2018-01-04 10:42:36 -05:00
2022-03-03 10:53:48 -05:00
use App\Entity\Lenses;
use App\Entity\PreviouslyOwnedLenses;
2018-01-04 10:42:36 -05:00
use Doctrine\ORM\EntityRepository;
class LensesRepository extends EntityRepository
{
2022-03-03 10:53:48 -05:00
use AcquireTrait;
2018-02-14 15:08:03 -05:00
2022-03-03 10:53:48 -05:00
public function deacquire(Lenses $currentRecord): void
{
$currentRecord->setFormerlyOwned(true)
->setReceived(true);
2018-01-04 10:42:36 -05:00
2022-03-03 10:53:48 -05:00
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
}
2018-01-04 10:42:36 -05:00
2022-03-03 10:53:48 -05:00
public function reacquire(PreviouslyOwnedLenses $currentRecord): void
{
$currentRecord->setFormerlyOwned(false);
2018-01-04 10:42:36 -05:00
2022-03-03 10:53:48 -05:00
$this->moveRecord($currentRecord, new Lenses());
}
2018-01-04 10:42:36 -05:00
}