-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/page projets #18
Changes from all commits
596d984
391fb48
e5fd244
80f69b4
c3f4927
461959a
cb1ac28
75586f3
8cfb78b
fef42f8
ef2ebb1
96620dd
e88ea4a
4c0ca5d
a31f437
484dc9a
d045a11
26c54e8
b9556a2
69aa149
51225e9
9346d67
a487d3a
8a882cf
81cdcd7
e9c79c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ when@dev: &dev | |
fixtures_path: fixtures | ||
|
||
when@test: *dev | ||
when@prod: *dev |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
App\Entity\ActorExpertise: | ||
actorexpertise_1: | ||
name: Planification urbaine | ||
actorexpertise_2: | ||
name: Elaboration et mise en œuvre de la politique algorithmique de la nation ainsi que de l’aménagement du territoire | ||
actorexpertise_3: | ||
name: Production de l’Information Géospatiale |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
App\Entity\AdministrativeScope: | ||
administrative_scope_1: | ||
name: National | ||
administrative_scope_2: | ||
name: Régional | ||
administrative_scope_3: | ||
name: Départemental | ||
administrative_scope_4: | ||
name: Communal | ||
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,11 @@ | |
|
||
namespace App\Entity; | ||
|
||
use ApiPlatform\Metadata\GetCollection; | ||
use App\Enum\AdministrativeScope; | ||
use App\Enum\Status; | ||
use Doctrine\DBAL\Types\Types; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use App\Enum\AdministrativeScopes; | ||
use ApiPlatform\Metadata\ApiResource; | ||
use App\Repository\ProjectRepository; | ||
use App\Entity\Trait\TimestampableEntity; | ||
|
@@ -15,30 +16,44 @@ | |
use Symfony\Component\Serializer\Attribute\Groups; | ||
|
||
#[ORM\Entity(repositoryClass: ProjectRepository::class)] | ||
#[ApiResource] | ||
#[ApiResource( | ||
paginationEnabled: false, | ||
operations: [ | ||
new GetCollection( | ||
normalizationContext: ['groups' => [self::PROJECT_READ_ALL]] | ||
) | ||
] | ||
)] | ||
class Project | ||
{ | ||
use TimestampableEntity; | ||
|
||
public const PROJECT_READ = 'project:read'; | ||
public const PROJECT_READ_ALL = 'project:read:all'; | ||
|
||
#[ORM\Id] | ||
#[ORM\GeneratedValue] | ||
#[ORM\Column] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?int $id = null; | ||
|
||
#[ORM\Column(length: 255)] | ||
#[Groups([Actor::ACTOR_READ_ITEM])] | ||
private ?string $title = null; | ||
#[Groups([self::PROJECT_READ_ALL, Actor::ACTOR_READ_ITEM])] | ||
private ?string $name = null; | ||
|
||
#[ORM\Column(length: 255)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?string $location = null; | ||
|
||
#[ORM\Column( | ||
type: PostGISType::GEOMETRY, | ||
options: ['geometry_type' => 'POINT'], | ||
)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?string $coords = null; | ||
|
||
#[ORM\Column(enumType: Status::class)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?Status $status = null; | ||
|
||
#[ORM\Column(type: Types::TEXT, nullable: true)] | ||
|
@@ -50,13 +65,15 @@ class Project | |
#[ORM\Column(type: Types::JSON, nullable: true)] | ||
private ?array $partners = null; | ||
|
||
#[ORM\Column(enumType: AdministrativeScopes::class)] | ||
private ?AdministrativeScopes $interventionZone = null; | ||
#[ORM\Column(enumType: AdministrativeScope::class)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?AdministrativeScope $interventionZone = null; | ||
|
||
/** | ||
* @var Collection<int, Thematic> | ||
*/ | ||
#[ORM\ManyToMany(targetEntity: Thematic::class, inversedBy: 'projects')] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private Collection $thematics; | ||
|
||
#[ORM\Column(length: 255, nullable: true)] | ||
|
@@ -78,13 +95,15 @@ class Project | |
private ?string $website = null; | ||
|
||
#[ORM\Column(length: 255, nullable: true)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?string $logo = null; | ||
|
||
/** | ||
* @var Collection<int, Actor> | ||
*/ | ||
#[ORM\JoinTable(name: 'financed_projects_actors')] | ||
#[ORM\ManyToMany(targetEntity: Actor::class)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Il va falloir qu'on voit avec Maelle, mais je ne suis pas sur qu'il s'agira d'acteurs au sens de la plateforme ici, probablement qu'il s'agira d'une chaine de caractères. A vérifier |
||
#[Groups([self::PROJECT_READ_ALL])] | ||
private Collection $financialActors; | ||
|
||
/** | ||
|
@@ -93,10 +112,12 @@ class Project | |
|
||
#[ORM\JoinTable(name: 'contracted_projects_actors')] | ||
#[ORM\ManyToMany(targetEntity: Actor::class)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Même chose ici |
||
private Collection $contractingActors; | ||
|
||
#[ORM\ManyToOne(inversedBy: 'projects')] | ||
#[ORM\JoinColumn(nullable: false)] | ||
#[Groups([self::PROJECT_READ_ALL])] | ||
private ?Actor $actor = null; | ||
|
||
public function __construct() | ||
|
@@ -111,14 +132,14 @@ public function getId(): ?int | |
return $this->id; | ||
} | ||
|
||
public function getTitle(): ?string | ||
public function getName(): ?string | ||
{ | ||
return $this->title; | ||
return $this->name; | ||
} | ||
|
||
public function setTitle(string $title): static | ||
public function setName(string $name): static | ||
{ | ||
$this->title = $title; | ||
$this->name = $name; | ||
|
||
return $this; | ||
} | ||
|
@@ -135,9 +156,14 @@ public function setLocation(string $location): static | |
return $this; | ||
} | ||
|
||
public function getCoords(): ?string | ||
{ | ||
return $this->coords; | ||
public function getCoords(): ?array { | ||
if (preg_match('/POINT\(([-\d\.]+) ([-\d\.]+)\)/', $this->coords, $matches)) { | ||
return [ | ||
'lat' => (float)$matches[1], | ||
'long' => (float)$matches[2], | ||
]; | ||
} | ||
return null; | ||
} | ||
|
||
public function setCoords(string $coords): static | ||
|
@@ -195,12 +221,12 @@ public function setPartners(?array $partners): static | |
return $this; | ||
} | ||
|
||
public function getInterventionZone(): ?AdministrativeScopes | ||
public function getInterventionZone(): ?AdministrativeScope | ||
{ | ||
return $this->interventionZone; | ||
} | ||
|
||
public function setInterventionZone(AdministrativeScopes $interventionZone): static | ||
public function setInterventionZone(AdministrativeScope $interventionZone): static | ||
{ | ||
$this->interventionZone = $interventionZone; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace App\Enum; | ||
|
||
use App\Enum\Trait\ToArray; | ||
|
||
enum AdministrativeScope: string | ||
{ | ||
case NATIONAL = 'national'; | ||
case REGIONAL = 'regional'; | ||
case STATE = 'state'; | ||
case CITY = 'city'; | ||
|
||
use ToArray; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je l'ai récupéré de ta branche mais dans l'idée plutot le gérer en enum.