mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
refactor: move DQL in repositories
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Domain;
|
||||
use App\Entity\DomainEntity;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
@@ -16,6 +17,18 @@ class DomainEntityRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, DomainEntity::class);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return DomainEntity[] Returns an array of DomainEntity objects
|
||||
// */
|
||||
|
||||
Reference in New Issue
Block a user