mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-24 09:50:17 -06:00
Fixed PHPStan errors due to API inconsistency in EntityManager and EntityManagerInterface
This commit is contained in:
parent
ea80b6d48a
commit
2012cc453c
@ -4,8 +4,7 @@ declare(strict_types=1);
|
||||
namespace Shlinkio\Shlink\Core\Service\Tag;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM;
|
||||
use Shlinkio\Shlink\Core\Entity\Tag;
|
||||
use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException;
|
||||
use Shlinkio\Shlink\Core\Repository\TagRepository;
|
||||
@ -16,11 +15,11 @@ class TagService implements TagServiceInterface
|
||||
use TagManagerTrait;
|
||||
|
||||
/**
|
||||
* @var EntityManager|EntityManagerInterface
|
||||
* @var ORM\EntityManagerInterface
|
||||
*/
|
||||
private $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
public function __construct(ORM\EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
@ -64,6 +63,7 @@ class TagService implements TagServiceInterface
|
||||
* @param string $newName
|
||||
* @return Tag
|
||||
* @throws EntityDoesNotExistException
|
||||
* @throws ORM\OptimisticLockException
|
||||
*/
|
||||
public function renameTag($oldName, $newName)
|
||||
{
|
||||
@ -75,7 +75,10 @@ class TagService implements TagServiceInterface
|
||||
}
|
||||
|
||||
$tag->setName($newName);
|
||||
$this->em->flush($tag);
|
||||
|
||||
/** @var ORM\EntityManager $em */
|
||||
$em = $this->em;
|
||||
$em->flush($tag);
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
@ -3,8 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Core\Service;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
|
||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||
@ -15,11 +14,11 @@ use Shlinkio\Shlink\Core\Repository\VisitRepository;
|
||||
class VisitsTracker implements VisitsTrackerInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager|EntityManagerInterface
|
||||
* @var ORM\EntityManagerInterface
|
||||
*/
|
||||
private $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
public function __construct(ORM\EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
@ -29,6 +28,8 @@ class VisitsTracker implements VisitsTrackerInterface
|
||||
*
|
||||
* @param string $shortCode
|
||||
* @param ServerRequestInterface $request
|
||||
* @throws ORM\ORMInvalidArgumentException
|
||||
* @throws ORM\OptimisticLockException
|
||||
*/
|
||||
public function track($shortCode, ServerRequestInterface $request)
|
||||
{
|
||||
@ -43,8 +44,10 @@ class VisitsTracker implements VisitsTrackerInterface
|
||||
->setReferer($request->getHeaderLine('Referer'))
|
||||
->setRemoteAddr($this->findOutRemoteAddr($request));
|
||||
|
||||
$this->em->persist($visit);
|
||||
$this->em->flush($visit);
|
||||
/** @var ORM\EntityManager $em */
|
||||
$em = $this->em;
|
||||
$em->persist($visit);
|
||||
$em->flush($visit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user