WIP: Symfony 6 project remake #2

Draft
skobkin wants to merge 103 commits from symfony6_remake into master
3 changed files with 25 additions and 39 deletions
Showing only changes of commit 5afc8d91b4 - Show all commits

View file

@ -1,16 +0,0 @@
<?php
namespace src\PointToolsBundle\Service\Factory;
use Psr\Log\LoggerInterface;
abstract class AbstractFactory
{
/** @var LoggerInterface */
protected $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View file

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace App\Factory;
use Psr\Log\LoggerInterface;
abstract class AbstractFactory
{
public function __construct(
protected LoggerInterface $logger,
) {
}
}

View file

@ -1,35 +1,25 @@
<?php
declare(strict_types=1);
namespace src\PointToolsBundle\Service\Factory;
namespace App\Factory;
use Psr\Log\LoggerInterface;
use src\PointToolsBundle\DTO\Api\User as UserDTO;
use src\PointToolsBundle\Entity\User;
use src\PointToolsBundle\Repository\UserRepository;
use src\PointToolsBundle\Exception\Factory\InvalidUserDataException;
use src\PointToolsBundle\Service\Factory\AbstractFactory;
use App\DTO\Api\User as UserDTO;
use App\Entity\User;
use App\Exception\Factory\InvalidUserDataException;
use App\Repository\UserRepository;
class UserFactory extends AbstractFactory
{
public const DATE_FORMAT = 'Y-m-d_H:i:s';
/** @var UserRepository */
private $userRepository;
public function __construct(LoggerInterface $logger, UserRepository $userRepository)
{
public function __construct(
LoggerInterface $logger,
private readonly UserRepository $userRepository,
) {
parent::__construct($logger);
$this->userRepository = $userRepository;
}
/**
* @param UserDTO $userData
*
* @return User
*
* @throws InvalidUserDataException
*/
public function findOrCreateFromDTO(UserDTO $userData): User
{
// @todo LOG
@ -56,9 +46,7 @@ class UserFactory extends AbstractFactory
return $user;
}
/**
* @return User[]
*/
/** @return User[] */
public function findOrCreateFromDTOArray(array $usersData): array
{
// @todo LOG