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

module: hexagonal architecture #44

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
step 3: Move entities to model
Antoine Lelaisant authored and AntoineGonzalez committed Apr 29, 2024

Unverified

This user has not yet uploaded their public signing key.
commit 93e6b3f03cca9ae569493e8d8a152a9b5f998f4b
4 changes: 2 additions & 2 deletions config/doctrine/orm/Dinosaur.orm.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<entity
name="App\Entity\Dinosaur"
name="Domain\Model\Dinosaur"
repository-class="App\Repository\DinosaurRepository"
table="dinosaur"
>
@@ -21,7 +21,7 @@

<many-to-one
field="species"
target-entity="App\Entity\Species"
target-entity="Domain\Model\Species"
inversed-by="dinosaurs" />

</entity>
2 changes: 1 addition & 1 deletion config/doctrine/orm/Species.orm.xml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@

<one-to-many
field="dinosaurs"
target-entity="App\Entity\Dinosaur"
target-entity="Domain\Model\Dinosaur"
mapped-by="species" />
</entity>

2 changes: 1 addition & 1 deletion config/doctrine/orm/User.orm.xml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<entity name="App\Entity\User" table="users">
<entity name="Domain\Model\User" table="users">

<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
4 changes: 2 additions & 2 deletions config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -24,8 +24,8 @@ doctrine:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/config/doctrine/orm'
prefix: 'App\Entity'
alias: App
prefix: 'Domain\Model'
alias: Domain

when@test:
doctrine:
2 changes: 1 addition & 1 deletion config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ security:
providers:
app_user_provider:
entity:
class: App\Entity\User
class: Domain\Model\User
property: email

role_hierarchy:
2 changes: 1 addition & 1 deletion src/Application/Controller/DinosaursController.php
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
use Application\Form\Type\DinosaurType;
use Application\Form\Type\SearchType;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Dinosaur;
use Domain\Model\Dinosaur;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
2 changes: 1 addition & 1 deletion src/Application/Controller/SpeciesController.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

use Application\Form\Type\SpeciesType;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Species;
use Domain\Model\Species;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
4 changes: 2 additions & 2 deletions src/Application/Form/Type/DinosaurType.php
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@

namespace Application\Form\Type;

use App\Entity\Dinosaur;
use App\Entity\Species;
use Domain\Model\Dinosaur;
use Domain\Model\Species;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ColorType;
2 changes: 1 addition & 1 deletion src/Application/Form/Type/SpeciesType.php
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

namespace Application\Form\Type;

use App\Entity\Species;
use Domain\Model\Species;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
2 changes: 1 addition & 1 deletion src/Application/Form/Type/UserType.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

namespace Application\Form\Type;

use App\Entity\User;
use Domain\Model\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
2 changes: 1 addition & 1 deletion src/Entity/Dinosaur.php → src/Domain/Model/Dinosaur.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Entity;
namespace Domain\Model;

class Dinosaur
{
2 changes: 1 addition & 1 deletion src/Entity/Species.php → src/Domain/Model/Species.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Entity;
namespace Domain\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
2 changes: 1 addition & 1 deletion src/Entity/User.php → src/Domain/Model/User.php
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Entity;
namespace Domain\Model;

use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
2 changes: 1 addition & 1 deletion src/Repository/DinosaurRepository.php
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

namespace App\Repository;

use App\Entity\Dinosaur;
use Domain\Model\Dinosaur;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;