chg: pkg: make a massive refactor to the backend and remove all unnecessary deps - and make small refactors for the frontend too #4
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
@@ -17,47 +17,17 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
/**
|
||||
* Class GamerRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author system7 <https://www.splendidbear.org>
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*/
|
||||
class GamerRepository extends ServiceEntityRepository
|
||||
{
|
||||
/**
|
||||
* GamerRepository constructor.
|
||||
*
|
||||
* @param ManagerRegistry $registry
|
||||
*/
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Gamer::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Gamer[] Returns an array of Gamer objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
{
|
||||
return $this->createQueryBuilder('g')
|
||||
->andWhere('g.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('g.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?Gamer
|
||||
{
|
||||
return $this->createQueryBuilder('g')
|
||||
->andWhere('g.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
@@ -17,8 +17,12 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
/**
|
||||
* Class GridRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author system7 <https://www.splendidbear.org>
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*
|
||||
* @method Grid|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Grid|null findOneBy(array $criteria, array $orderBy = null)
|
||||
@@ -27,42 +31,8 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
*/
|
||||
class GridRepository extends ServiceEntityRepository
|
||||
{
|
||||
/**
|
||||
* GridRepository constructor.
|
||||
*
|
||||
* @param ManagerRegistry $registry
|
||||
*/
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Grid::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Grid[] Returns an array of Grid objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
{
|
||||
return $this->createQueryBuilder('g')
|
||||
->andWhere('g.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('g.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?Grid
|
||||
{
|
||||
return $this->createQueryBuilder('g')
|
||||
->andWhere('g.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
@@ -17,8 +17,12 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
/**
|
||||
* Class GridRowRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author system7 <https://www.splendidbear.org>
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*
|
||||
* @method GridRow|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method GridRow|null findOneBy(array $criteria, array $orderBy = null)
|
||||
@@ -27,42 +31,8 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
*/
|
||||
class GridRowRepository extends ServiceEntityRepository
|
||||
{
|
||||
/**
|
||||
* GridRowRepository constructor.
|
||||
*
|
||||
* @param ManagerRegistry $registry
|
||||
*/
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, GridRow::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return GridRow[] Returns an array of GridRow objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
{
|
||||
return $this->createQueryBuilder('g')
|
||||
->andWhere('g.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('g.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?GridRow
|
||||
{
|
||||
return $this->createQueryBuilder('g')
|
||||
->andWhere('g.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
@@ -17,13 +17,18 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
/**
|
||||
* Class PlayedGameRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author system7 <https://www.splendidbear.org>
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*
|
||||
* @method PlayedGame|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method PlayedGame|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method PlayedGame[] findAll()
|
||||
* @method PlayedGame[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
* @method PlayedGame|null findOneByGameAssoc($gameAssoc)
|
||||
*/
|
||||
class PlayedGameRepository extends ServiceEntityRepository
|
||||
{
|
||||
@@ -36,33 +41,4 @@ class PlayedGameRepository extends ServiceEntityRepository
|
||||
{
|
||||
parent::__construct($registry, PlayedGame::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return PlayedGame[] Returns an array of PlayedGame objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
{
|
||||
return $this->createQueryBuilder('p')
|
||||
->andWhere('p.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('p.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?PlayedGame
|
||||
{
|
||||
return $this->createQueryBuilder('p')
|
||||
->andWhere('p.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
@@ -17,8 +17,12 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
/**
|
||||
* Class StepRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author system7 <https://www.splendidbear.org>
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*
|
||||
* @method Step|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Step|null findOneBy(array $criteria, array $orderBy = null)
|
||||
@@ -27,42 +31,8 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
*/
|
||||
class StepRepository extends ServiceEntityRepository
|
||||
{
|
||||
/**
|
||||
* StepRepository constructor.
|
||||
*
|
||||
* @param ManagerRegistry $registry
|
||||
*/
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Step::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Step[] Returns an array of Step objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
->andWhere('s.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('s.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?Step
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
->andWhere('s.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
54
src/Repository/UserRepository.php
Normal file
54
src/Repository/UserRepository.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
* Copyright (c) 2026 @ www.splendidbear.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
|
||||
/**
|
||||
* Class UserRepository
|
||||
*
|
||||
* @package App\Repository
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*
|
||||
* @extends ServiceEntityRepository<User>
|
||||
*/
|
||||
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, User::class);
|
||||
}
|
||||
|
||||
public function findOneByUsername(string $username): ?User
|
||||
{
|
||||
return $this->findOneBy(['username' => $username]);
|
||||
}
|
||||
|
||||
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
|
||||
}
|
||||
|
||||
$user->setPassword($newHashedPassword);
|
||||
$this->getEntityManager()->persist($user);
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user