Files
Phraseanet/lib/Alchemy/Phrasea/Model/Repositories/SessionRepository.php
Aina Sitraka f9de6877d2 PHRAS-3742 Admin flush session (#4131)
PHRAS-3742 : 
- flush session
- command
- redis remove by pattern
- cmd
- add log
- clean table session
2022-10-05 16:56:13 +02:00

38 lines
862 B
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Model\Repositories;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\EntityRepository;
/**
* SessionRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class SessionRepository extends EntityRepository
{
public function deleteAllExceptSessionId($sessionId)
{
$criteria = new Criteria();
$criteria->where($criteria->expr()->neq('id', $sessionId));
$sessions = $this->matching($criteria);
foreach ($sessions as $session) {
$this->_em->remove($session);
}
$this->_em->flush();
}
}