for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Stu\Orm\Repository;
use Doctrine\ORM\EntityRepository;
use Stu\Orm\Entity\GameTurn;
use Stu\Orm\Entity\GameTurnInterface;
/**
* @extends EntityRepository<GameTurn>
*/
final class GameTurnRepository extends EntityRepository implements GameTurnRepositoryInterface
{
public function getCurrent(): ?GameTurnInterface
return $this->findOneBy(
[],
['turn' => 'desc']
);
}
public function prototype(): GameTurnInterface
return new GameTurn();
public function save(GameTurnInterface $turn): void
$em = $this->getEntityManager();
$em->persist($turn);
$em->flush();
public function delete(GameTurnInterface $turn): void
$em->remove($turn);
public function truncateAllGameTurns(): void
$this->getEntityManager()->createQuery(
sprintf(
'DELETE FROM %s gt',
GameTurn::class
)
)->execute();