Issues (62)

Repository/AccountTokenRepository.php (1 issue)

Severity
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Repository;
4
5
use Doctrine\DBAL\Types\Type;
6
use Doctrine\ORM\EntityRepository;
7
use Exception;
8
9
class AccountTokenRepository extends EntityRepository
10
{
11
    /**
12
     * method to find UserToken to archive
13
     * @param int $max_inactivation_days
14
     * @return mixed
15
     * @throws Exception
16
     */
17
    public function findByExpiredToken(int $max_inactivation_days)
18
    {
19
        $now = new \DateTime();
20
        $now->sub(new \DateInterval("P" . $max_inactivation_days . "D"));
21
22
        $query = $this->getEntityManager()->createQuery("SELECT u FROM App:AccountToken u WHERE
23
			u.endToken < :max_inactivation_days
24
		");
25
26
        $query->setParameter("max_inactivation_days", $now, Type::DATETIME);
0 ignored issues
show
Deprecated Code introduced by
The constant Doctrine\DBAL\Types\Type::DATETIME has been deprecated: Use {@see Types::DATETIME_MUTABLE} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

26
        $query->setParameter("max_inactivation_days", $now, /** @scrutinizer ignore-deprecated */ Type::DATETIME);

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
27
28
        return $query->getResult();
29
    }
30
}
31