Files
domain-watchdog/src/Repository/DomainEntityRepository.php

57 lines
1.7 KiB
PHP
Raw Normal View History

2024-07-10 23:30:59 +02:00
<?php
namespace App\Repository;
2025-10-21 12:52:43 +02:00
use App\Entity\Domain;
2024-07-10 23:30:59 +02:00
use App\Entity\DomainEntity;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<DomainEntity>
*/
class DomainEntityRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, DomainEntity::class);
}
2025-10-21 12:52:43 +02:00
public function setDomainEntityAsDeleted(Domain $domain)
{
return $this->createQueryBuilder('de')
->update()
->set('de.deletedAt', ':now')
->where('de.domain = :domain')
->andWhere('de.deletedAt IS NOT NULL')
->setParameter('now', new \DateTimeImmutable())
->setParameter('domain', $domain)
->getQuery()->execute();
}
2024-08-02 23:24:52 +02:00
// /**
// * @return DomainEntity[] Returns an array of DomainEntity objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
2024-07-10 23:30:59 +02:00
2024-08-02 23:24:52 +02:00
// public function findOneBySomeField($value): ?DomainEntity
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
2024-07-10 23:30:59 +02:00
}