Create snippets skeleton

This commit is contained in:
Tim
2023-04-03 23:44:13 +02:00
parent bf83e5aabd
commit 921dcf1e97
15 changed files with 310 additions and 30 deletions

View File

@ -0,0 +1,66 @@
<?php
namespace App\Repository;
use App\Entity\Snip;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Snip>
*
* @method Snip|null find($id, $lockMode = null, $lockVersion = null)
* @method Snip|null findOneBy(array $criteria, array $orderBy = null)
* @method Snip[] findAll()
* @method Snip[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SnipRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Snip::class);
}
public function save(Snip $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Snip $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Snip[] Returns an array of Snip objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Snip
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}