Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AllBundles] Replace deprecated doctrine string entity alias to fqcn #2662

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Kunstmaan/AdminBundle/Command/ApplyAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function isRunning()
{
// Check if we have records in running state, if so read PID & check if process is active
/* @var AclChangeset $runningAclChangeset */
$runningAclChangeset = $this->em->getRepository('KunstmaanAdminBundle:AclChangeset')->findRunningChangeset();
$runningAclChangeset = $this->em->getRepository(AclChangeset::class)->findRunningChangeset();
// Found running process, check if PID is still running
if (!\is_null($runningAclChangeset) && !$this->shellHelper->isRunning($runningAclChangeset->getPid())) {
// PID not running, process probably failed...
Expand Down
4 changes: 2 additions & 2 deletions src/Kunstmaan/AdminBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function indexAction()
/* @var DashboardConfiguration $dashboardConfiguration */
$dashboardConfiguration = $this->getDoctrine()
->getManager()
->getRepository('KunstmaanAdminBundle:DashboardConfiguration')
->getRepository(DashboardConfiguration::class)
->findOneBy(array());

return array('dashboardConfiguration' => $dashboardConfiguration);
Expand All @@ -57,7 +57,7 @@ public function editIndexAction(Request $request)

/* @var DashboardConfiguration $dashboardConfiguration */
$dashboardConfiguration = $em
->getRepository('KunstmaanAdminBundle:DashboardConfiguration')
->getRepository(DashboardConfiguration::class)
->findOneBy(array());

if (\is_null($dashboardConfiguration)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function getPermission($role)
*/
public function getAllRoles()
{
return $this->em->getRepository('KunstmaanAdminBundle:Role')->findAll();
return $this->em->getRepository(Role::class)->findAll();
}

/**
Expand All @@ -185,7 +185,7 @@ public function getAllRoles()
*/
public function getManageableRolesForPages()
{
$roles = $this->em->getRepository('KunstmaanAdminBundle:Role')->findAll();
$roles = $this->em->getRepository(Role::class)->findAll();

if (($token = $this->tokenStorage->getToken()) && ($user = $token->getUser())) {
if ($user && !$user->isSuperAdmin() && ($superAdminRole = array_keys($roles, 'ROLE_SUPER_ADMIN'))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\GroupInterface;
use Kunstmaan\AdminBundle\Entity\Group;
use Kunstmaan\AdminBundle\Entity\User;

class OAuthUserCreator implements OAuthUserCreatorInterface
Expand Down Expand Up @@ -58,7 +59,7 @@ public function getOrCreateUser($email, $googleId)

foreach ($this->getAccessLevels($email) as $accessLevel) {
/** @var GroupInterface $group */
$group = $this->em->getRepository('KunstmaanAdminBundle:Group')->findOneBy(['name' => $accessLevel]);
$group = $this->em->getRepository(Group::class)->findOneBy(['name' => $accessLevel]);
if (null !== $group) {
$user->addGroup($group);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/AdminBundle/Service/AclManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function updateNodesAclToRole(array $nodes, $role, $mask)
public function applyAclChangesets()
{
/* @var AclChangesetRepository $aclRepo */
$aclRepo = $this->em->getRepository('KunstmaanAdminBundle:AclChangeset');
$aclRepo = $this->em->getRepository(AclChangeset::class);
do {
/* @var AclChangeset $changeset */
$changeset = $aclRepo->findNewChangeset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Kunstmaan\AdminBundle\Entity\AbstractEntity;
use Kunstmaan\AdminBundle\Entity\Role;
use Kunstmaan\AdminBundle\Entity\User;
use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\MaskBuilder;
use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionAdmin;
Expand Down Expand Up @@ -78,7 +79,7 @@ public function testGetAllRoles()
$em = $this->getEntityManager();
$em->expects($this->once())
->method('getRepository')
->with('KunstmaanAdminBundle:Role')
->with(Role::class)
->will($this->returnValue($roleRepo));
$context = $this->getTokenStorage();
$aclProvider = $this->getAclProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function isEntityLocked(User $user, LockableEntityInterface $entity)
protected function createEntityVersionLock(User $user, LockableEntity $entity)
{
/** @var EntityVersionLock $lock */
$lock = $this->objectManager->getRepository('KunstmaanAdminListBundle:EntityVersionLock')->findOneBy([
$lock = $this->objectManager->getRepository(EntityVersionLock::class)->findOneBy([
'owner' => $user->getUsername(),
'lockableEntity' => $entity,
]);
Expand Down Expand Up @@ -134,7 +134,7 @@ function ($return, EntityVersionLock $item) {
*/
protected function removeExpiredLocks(LockableEntity $entity)
{
$locks = $this->objectManager->getRepository('KunstmaanAdminListBundle:EntityVersionLock')->getExpiredLocks($entity, $this->threshold);
$locks = $this->objectManager->getRepository(EntityVersionLock::class)->getExpiredLocks($entity, $this->threshold);
foreach ($locks as $lock) {
$this->objectManager->remove($lock);
}
Expand All @@ -151,7 +151,7 @@ protected function removeExpiredLocks(LockableEntity $entity)
protected function getEntityVersionLocksByLockableEntity(LockableEntity $entity, User $userToExclude = null)
{
/** @var EntityVersionLockRepository $objectRepository */
$objectRepository = $this->objectManager->getRepository('KunstmaanAdminListBundle:EntityVersionLock');
$objectRepository = $this->objectManager->getRepository(EntityVersionLock::class);

return $objectRepository->getLocksForLockableEntity($entity, $this->threshold, $userToExclude);
}
Expand All @@ -166,7 +166,7 @@ protected function getEntityVersionLocksByLockableEntity(LockableEntity $entity,
protected function getLockableEntity(LockableEntityInterface $entity, $create = true)
{
/** @var LockableEntity $lockable */
$lockable = $this->objectManager->getRepository('KunstmaanAdminListBundle:LockableEntity')->getOrCreate($entity->getId(), \get_class($entity));
$lockable = $this->objectManager->getRepository(LockableEntity::class)->getOrCreate($entity->getId(), \get_class($entity));

if ($create === true && $lockable->getId() === null) {
$this->objectManager->persist($lockable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ protected function setUp()
->will($this->returnValueMap($lockableMap));

$repositoryMap = [
['KunstmaanAdminListBundle:EntityVersionLock', $mockLockRepository],
['KunstmaanAdminListBundle:LockableEntity', $mockLockableRepository],
[EntityVersionLock::class, $mockLockRepository],
[LockableEntity::class, $mockLockableRepository],
];
$mockObjectManager = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\StringFilterType;
use Kunstmaan\ArticleBundle\Entity\AbstractArticleOverviewPage;
use Kunstmaan\NodeBundle\Entity\Node;
use Kunstmaan\NodeBundle\Entity\NodeTranslation;

/**
* The AdminList configurator for the AbstractArticlePage
Expand Down Expand Up @@ -91,7 +92,7 @@ public function buildFields()
protected function getQueryBuilder()
{
$queryBuilder = $this->em
->getRepository('KunstmaanNodeBundle:NodeTranslation')
->getRepository(NodeTranslation::class)
->createQueryBuilder('b');

return $queryBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Kunstmaan\DashboardBundle\Command;

use Kunstmaan\DashboardBundle\Entity\AnalyticsConfig;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -81,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function getconfigs()
{
// get all segments
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);

return $configRepository->findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\GoalCommandHelper;
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\MetricsCommandHelper;
use Kunstmaan\DashboardBundle\Command\Helper\Analytics\UsersCommandHelper;
use Kunstmaan\DashboardBundle\Entity\AnalyticsConfig;
use Kunstmaan\DashboardBundle\Entity\AnalyticsOverview;
use Kunstmaan\DashboardBundle\Entity\AnalyticsSegment;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -159,7 +161,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function getSingleOverview($overviewId)
{
// get specified overview
$overviewRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
$overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
$overview = $overviewRepository->find($overviewId);

if (!$overview) {
Expand All @@ -179,7 +181,7 @@ private function getSingleOverview($overviewId)
private function getOverviewsOfSegment($segmentId)
{
// get specified segment
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$segment = $segmentRepository->find($segmentId);

if (!$segment) {
Expand All @@ -202,9 +204,9 @@ private function getOverviewsOfSegment($segmentId)
*/
private function getOverviewsOfConfig($configId)
{
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$overviewRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
// get specified config
$config = $configRepository->find($configId);

Expand Down Expand Up @@ -234,9 +236,9 @@ private function getOverviewsOfConfig($configId)
*/
private function getAllOverviews()
{
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$overviewRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);
$overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$configs = $configRepository->findAll();

foreach ($configs as $config) {
Expand Down Expand Up @@ -299,7 +301,7 @@ public function updateData($overviews)
$this->em->persist($overview);
$this->em->flush();

$this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->setUpdated($overview->getConfig()->getId());
$this->em->getRepository(AnalyticsConfig::class)->setUpdated($overview->getConfig()->getId());
} catch (\Google_ServiceException $e) {
$error = explode(')', $e->getMessage());
$error = $error[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
namespace Kunstmaan\DashboardBundle\Command;

use Doctrine\ORM\EntityManagerInterface;
use Kunstmaan\DashboardBundle\Entity\AnalyticsConfig;
use Kunstmaan\DashboardBundle\Entity\AnalyticsOverview;
use Kunstmaan\DashboardBundle\Entity\AnalyticsSegment;
use Kunstmaan\DashboardBundle\Repository\AnalyticsSegmentRepository;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -110,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function generateOverviewsOfSegment($segmentId)
{
/** @var AnalyticsSegmentRepository $segmentRepository */
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$segment = $segmentRepository->find($segmentId);

if (!$segment) {
Expand All @@ -132,9 +135,9 @@ private function generateOverviewsOfSegment($segmentId)
*/
private function generateOverviewsOfConfig($configId)
{
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$overviewRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
// get specified config
$config = $configRepository->find($configId);

Expand All @@ -161,9 +164,9 @@ private function generateOverviewsOfConfig($configId)
*/
private function generateAllOverviews()
{
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$overviewRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);
$overviewRepository = $this->em->getRepository(AnalyticsOverview::class);
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$configs = $configRepository->findAll();

foreach ($configs as $config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Kunstmaan\DashboardBundle\Command;

use Kunstmaan\DashboardBundle\Entity\AnalyticsConfig;
use Kunstmaan\DashboardBundle\Entity\AnalyticsOverview;
use Kunstmaan\DashboardBundle\Entity\AnalyticsSegment;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -118,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function getOverviewsOfSegment($segmentId)
{
// get specified segment
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);
$segment = $segmentRepository->find($segmentId);

if (!$segment) {
Expand All @@ -139,7 +142,7 @@ private function getOverviewsOfSegment($segmentId)
private function getOverviewsOfConfig($configId)
{
// get specified config
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);
$config = $configRepository->find($configId);

if (!$config) {
Expand All @@ -158,7 +161,7 @@ private function getOverviewsOfConfig($configId)
private function getAllOverviews()
{
// get all overviews
$overviewRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
$overviewRepository = $this->em->getRepository(AnalyticsOverview::class);

return $overviewRepository->findAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Kunstmaan\DashboardBundle\Command;

use Kunstmaan\DashboardBundle\Entity\AnalyticsConfig;
use Kunstmaan\DashboardBundle\Entity\AnalyticsSegment;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -103,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function getSegmentsOfConfig($configId)
{
// get specified config
$configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');
$configRepository = $this->em->getRepository(AnalyticsConfig::class);
$config = $configRepository->find($configId);

if (!$config) {
Expand All @@ -122,7 +124,7 @@ private function getSegmentsOfConfig($configId)
private function getAllSegments()
{
// get all segments
$segmentRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment');
$segmentRepository = $this->em->getRepository(AnalyticsSegment::class);

return $segmentRepository->findAll();
}
Expand Down
Loading