master
Xantxo COQUILLARD 3 years ago
parent 1c1971dc71
commit 0934124428

1
.gitignore vendored

@ -9,3 +9,4 @@
/vendor/
###< symfony/framework-bundle ###
.env
.idea

@ -1,5 +1,5 @@
controllers:
resource: ../src/Controller/
resource: ../src/App/Controller/
type: annotation
kernel:

@ -0,0 +1,96 @@
<?php
namespace App\Composant\User\Domain;
class User
{
private string $lastname, $firstname;
private int $roleId;
private float $kwhPrice, $hourlyCost;
public function __construct()
{
}
/**
* @return float
*/
public function getKwhPrice(): float
{
return $this->kwhPrice;
}
/**
* @param float $kwhPrice
*/
public function setKwhPrice(float $kwhPrice): void
{
$this->kwhPrice = $kwhPrice;
}
/**
* @return float
*/
public function getHourlyCost(): float
{
return $this->hourlyCost;
}
/**
* @param float $hourlyCost
*/
public function setHourlyCost(float $hourlyCost): void
{
$this->hourlyCost = $hourlyCost;
}
/**
* @return int
*/
public function getRoleId(): int
{
return $this->roleId;
}
/**
* @param int $roleId
*/
public function setRoleId(int $roleId): void
{
$this->roleId = $roleId;
}
/**
* @return string
*/
public function getLastname(): string
{
return $this->lastname;
}
/**
* @param string $lastname
*/
public function setLastname(string $lastname): void
{
$this->lastname = $lastname;
}
/**
* @return string
*/
public function getFirstname(): string
{
return $this->firstname;
}
/**
* @param string $firstname
*/
public function setFirstname(string $firstname): void
{
$this->firstname = $firstname;
}
}

@ -0,0 +1,9 @@
<?php
namespace App\Composant\User\Domain;
interface UserDataMapper
{
public function findById(int $id): User;
public function findAll(): array;
}

@ -0,0 +1,21 @@
<?php
namespace App\Composant\User\Infrastructure;
use App\Composant\User\Domain\User;
use App\Composant\User\Domain\UserDataMapper;
use Doctrine\Persistence\ManagerRegistry;
class DoctrineUser implements UserDataMapper
{
public function findById(int $id): User
{
// TODO: Implement findById() method.
}
public function findAll(): array
{
// TODO: Implement findAll() method.
}
}

@ -0,0 +1,38 @@
<?php
namespace App\Controller;
use App\Composant\User\Domain\User;
use App\Composant\User\Infrastructure\DoctrineUser;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
class test
{
public function __construct()
{
}
/**
* @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%'"
*/
public function index(): Response
{
$DoctrineUser = new DoctrineUser();
$DoctrineUser->findById(1);
return new Response(
'Content',
Response::HTTP_OK,
['content-type' => 'text/html']
);
}
}
Loading…
Cancel
Save