correction
This commit is contained in:
parent
3c646640dc
commit
c8c3b42b0e
@ -7,15 +7,19 @@
|
||||
"php": ">=8.0.2",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"doctrine/annotations": "^1.13",
|
||||
"doctrine/doctrine-bundle": "^2.6",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.2",
|
||||
"doctrine/orm": "^2.11",
|
||||
"symfony/console": "6.0.*",
|
||||
"symfony/dotenv": "6.0.*",
|
||||
"symfony/expression-language": "6.0.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/framework-bundle": "6.0.*",
|
||||
"symfony/proxy-manager-bridge": "6.0.*",
|
||||
"symfony/runtime": "6.0.*",
|
||||
"symfony/yaml": "6.0.*"
|
||||
},
|
||||
"require-dev": {
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": true,
|
||||
@ -66,5 +70,8 @@
|
||||
"allow-contrib": false,
|
||||
"require": "6.0.*"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/maker-bundle": "^1.38"
|
||||
}
|
||||
}
|
||||
|
1961
composer.lock
generated
1961
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ doctrine:
|
||||
mappings:
|
||||
App:
|
||||
is_bundle: false
|
||||
dir: '%kernel.project_dir%/src/App/Composant'
|
||||
dir: '%kernel.project_dir%/src/Composant'
|
||||
prefix: 'App\Composant'
|
||||
alias: App
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
controllers:
|
||||
resource: ../src/App/Controller/
|
||||
resource: ../src/Controller/
|
||||
type: annotation
|
||||
|
||||
kernel:
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Composant\User\Domain;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="users")
|
@ -4,8 +4,8 @@ namespace App\Composant\User\Infrastructure;
|
||||
|
||||
use App\Composant\User\Domain\User;
|
||||
use App\Composant\User\Domain\UserDataMapper;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Exception;
|
||||
|
||||
class DoctrineUser extends ServiceEntityRepository implements UserDataMapper
|
||||
@ -18,15 +18,16 @@ class DoctrineUser extends ServiceEntityRepository implements UserDataMapper
|
||||
|
||||
public function findById(int $id): User
|
||||
{
|
||||
$entityManager = $this->getEntityManager();
|
||||
$User = $entityManager->getRepository(User::class)->find($id);
|
||||
if (!$User) {
|
||||
$user = $this->find($id);
|
||||
|
||||
if (!$user)
|
||||
{
|
||||
throw new Exception(
|
||||
'L\'utilisateur n\'existe pas'
|
||||
);
|
||||
}
|
||||
|
||||
return $User;
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function findAll(): array
|
@ -2,12 +2,11 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Composant\User\Domain\User;
|
||||
use App\Composant\User\Infrastructure\DoctrineUser;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use function dd;
|
||||
|
||||
class test extends AbstractController
|
||||
{
|
||||
@ -16,16 +15,7 @@ class test extends AbstractController
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(
|
||||
* "/contact",
|
||||
* name="contact",
|
||||
* condition="context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'"
|
||||
* )
|
||||
*
|
||||
* expressions can also include configuration parameters:
|
||||
* condition: "request.headers.get('User-Agent') matches '%app.allowed_browsers%'"
|
||||
*/
|
||||
#[Route('/foo', name: 'contact')]
|
||||
public function index(ManagerRegistry $registry): Response
|
||||
{
|
||||
$DoctrineUser = new DoctrineUser($registry);
|
Loading…
Reference in New Issue
Block a user