diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/HegreLand.iml b/.idea/HegreLand.iml new file mode 100644 index 0000000..f4221e4 --- /dev/null +++ b/.idea/HegreLand.iml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..2f49ddd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..081b958 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml new file mode 100644 index 0000000..4f8104c --- /dev/null +++ b/.idea/phpunit.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 367af25..dc7ca17 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -4,14 +4,18 @@ security: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider providers: - users_in_memory: { memory: null } + # used to reload user from session & other features (e.g. switch_user) + app_user_provider: + entity: + class: App\Entity\Employee + property: email firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: lazy: true - provider: users_in_memory + provider: app_user_provider # activate different ways to authenticate # https://symfony.com/doc/current/security.html#the-firewall diff --git a/src/Entity/Assignment.php b/src/Entity/Assignment.php index b13ad54..ad69428 100644 --- a/src/Entity/Assignment.php +++ b/src/Entity/Assignment.php @@ -22,4 +22,46 @@ class Assignment #[ORM\Column] private ?\DateTime $endHour = null; + + public function getStartHour(): ?\DateTime + { + return $this->startHour; + } + + public function getEmployee(): ?Employee + { + return $this->employee; + } + + public function setEmployee(?Employee $employee): void + { + $this->employee = $employee; + } + + public function getRide(): ?Ride + { + return $this->ride; + } + + public function setRide(?Ride $ride): void + { + $this->ride = $ride; + } + + public function setStartHour(?\DateTime $startHour): void + { + $this->startHour = $startHour; + } + + public function getEndHour(): ?\DateTime + { + return $this->endHour; + } + + public function setEndHour(?\DateTime $endHour): void + { + $this->endHour = $endHour; + } + + } diff --git a/src/Entity/Category.php b/src/Entity/Category.php index 93a06d7..7ab1308 100644 --- a/src/Entity/Category.php +++ b/src/Entity/Category.php @@ -3,6 +3,7 @@ namespace App\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -16,6 +17,12 @@ class Category #[ORM\Column(length: 30)] private ?string $label = null; + #[ORM\ManyToOne(targetEntity: Mission::class, inversedBy: 'category')] + private ?Mission $mission = null; + + #[ORM\ManyToOne(targetEntity: MissionCategory::class, inversedBy: 'category')] + private Collection $missionCategory; + public function getId(): ?int { return $this->id; @@ -40,5 +47,28 @@ class Category return $this; } + public function getMission(): ?Mission + { + return $this->mission; + } + + public function setMission(?Mission $mission): void + { + $this->mission = $mission; + } + + public function getMissionCategory(): Collection + { + return $this->missionCategory; + } + + public function setMissionCategory(Collection $missionCategory): void + { + $this->missionCategory = $missionCategory; + } + + + + } -?> + diff --git a/src/Entity/Employee.php b/src/Entity/Employee.php index 578c4df..6b602ba 100644 --- a/src/Entity/Employee.php +++ b/src/Entity/Employee.php @@ -30,6 +30,9 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\Column] private ?string $password = null; + #[ORM\Column] + private array $roles = []; + #[ORM\ManyToOne(targetEntity: EmployeeSkill::class, inversedBy: 'employee')] private Collection $employeeskills; @@ -165,4 +168,45 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface { return (string) $this->email; } + + public function getRoles(): array + { + $roles = $this->roles; + // guarantee every user at least has ROLE_USER + $roles[] = 'ROLE_USER'; + + return array_unique($roles); + } + + /** + * @param list $roles + */ + public function setRoles(array $roles): static + { + $this->roles = $roles; + + return $this; + } + + public function getMissions(): Collection + { + return $this->missions; + } + + public function setMissions(Collection $missions): void + { + $this->missions = $missions; + } + + public function getIncidents(): Collection + { + return $this->incidents; + } + + public function setIncidents(Collection $incidents): void + { + $this->incidents = $incidents; + } + + } diff --git a/src/Entity/EmployeeSkill.php b/src/Entity/EmployeeSkill.php index 887eb6f..efbaae9 100644 --- a/src/Entity/EmployeeSkill.php +++ b/src/Entity/EmployeeSkill.php @@ -4,16 +4,39 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Table(name: 'Requirements')] -class Requirements +#[ORM\Table(name: 'EmployeeSkill')] +class EmployeeSkill { #[ORM\Id] - #[ORM\OneToMany(targetEntity: Mission::class, mappedBy: 'requirements')] + #[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'EmployeeSkills')] #[ORM\JoinColumn(nullable: false)] - private ?Mission $mission = null; + private ?Employee $employee = null; #[ORM\Id] - #[ORM\OneToMany(targetEntity: Skill::class, mappedBy: 'requirements')] + #[ORM\OneToMany(targetEntity: Skill::class, mappedBy: 'EmployeeSkills')] #[ORM\JoinColumn(nullable: false)] private ?Skill $skill = null; + + public function getSkill(): ?Skill + { + return $this->skill; + } + + public function setSkill(?Skill $skill): void + { + $this->skill = $skill; + } + + public function getEmployee(): ?Employee + { + return $this->employee; + } + + public function setEmployee(?Employee $employee): void + { + $this->employee = $employee; + } + + + } diff --git a/src/Entity/Incident.php b/src/Entity/Incident.php index a02d272..d311bd8 100644 --- a/src/Entity/Incident.php +++ b/src/Entity/Incident.php @@ -2,6 +2,7 @@ namespace App\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; class Incident @@ -14,6 +15,25 @@ class Incident #[ORM\Column(length: 255)] private ?string $description = null; + #[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'incident')] + private ?Employee $employee; + + #[ORM\OneToMany(targetEntity: IncidentType::class, mappedBy: 'incident')] + private ?IncidentType $incidentType; + + #[ORM\OneToMany(targetEntity: Ride::class, mappedBy: 'incident')] + private ?Ride $ride; + + public function getEmployeeincidents(): Collection + { + return $this->employeeincidents; + } + + public function setEmployeeincidents(Collection $employeeincidents): void + { + $this->employeeincidents = $employeeincidents; + } + public function getId(): ?int { return $this->id; @@ -38,5 +58,37 @@ class Incident return $this; } + public function getEmployee(): ?Employee + { + return $this->employee; + } + + public function setEmployee(?Employee $employee): void + { + $this->employee = $employee; + } + + public function getIncidentType(): ?IncidentType + { + return $this->incidentType; + } + + public function setIncidentType(?IncidentType $incidentType): void + { + $this->incidentType = $incidentType; + } + + public function getRide(): ?Ride + { + return $this->ride; + } + + public function setRide(?Ride $ride): void + { + $this->ride = $ride; + } + + + } -?> + diff --git a/src/Entity/IncidentType.php b/src/Entity/IncidentType.php index 08cf5a8..5499ab3 100644 --- a/src/Entity/IncidentType.php +++ b/src/Entity/IncidentType.php @@ -3,6 +3,7 @@ namespace App\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -16,6 +17,9 @@ class IncidentType #[ORM\Column(length: 30)] private ?string $label = null; + #[ORM\ManyToOne(targetEntity: Incident::class, inversedBy: 'incidentType')] + private Collection $incidents; + public function getId(): ?int { return $this->id; @@ -40,5 +44,17 @@ class IncidentType return $this; } + public function getIncidents(): Collection + { + return $this->incidents; + } + + public function setIncidents(Collection $incidents): void + { + $this->incidents = $incidents; + } + + + } -?> + diff --git a/src/Entity/Mission.php b/src/Entity/Mission.php index 0b26d78..b1dfb2d 100644 --- a/src/Entity/Mission.php +++ b/src/Entity/Mission.php @@ -3,6 +3,7 @@ namespace App\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -16,8 +17,41 @@ class Mission #[ORM\Column(length: 30)] private ?string $label = null; - #[ORM\ManyToOne(targetEntity: Requirements::class, inversedBy: 'missions')] - private ?Requirements $requirements = null; + #[ORM\ManyToOne(targetEntity: Requirement::class, inversedBy: 'mission')] + private Collection $requirements; + + #[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'mission')] + private ?employee $employee = null; + + #[ORM\OneToMany(targetEntity: Category::class, mappedBy: 'mission')] + private Collection $categories; + + #[ORM\OneToMany(targetEntity: Ride::class, mappedBy: 'mission')] + private ?Ride $ride; + + #[ORM\ManyToOne(targetEntity: MissionCategory::class, inversedBy: 'mission')] + private Collection $missionCategory; + + public function getRequirements(): Collection + { + return $this->requirements; + } + + public function setRequirements(Collection $requirements): void + { + $this->requirements = $requirements; + } + + public function getEmployeemissions(): Collection + { + return $this->employeemissions; + } + + public function setEmployeemissions(Collection $employeemissions): void + { + $this->employeemissions = $employeemissions; + } + public function getId(): ?int { @@ -43,5 +77,48 @@ class Mission return $this; } + public function getEmployee(): ?employee + { + return $this->employee; + } + + public function setEmployee(?employee $employee): void + { + $this->employee = $employee; + } + + public function getCategories(): Collection + { + return $this->categories; + } + + public function setCategories(Collection $categories): void + { + $this->categories = $categories; + } + + public function getRide(): ?Ride + { + return $this->ride; + } + + public function setRide(?Ride $ride): void + { + $this->ride = $ride; + } + + public function getMissionCategory(): Collection + { + return $this->missionCategory; + } + + public function setMissionCategory(Collection $missionCategory): void + { + $this->missionCategory = $missionCategory; + } + + + } -?> + + diff --git a/src/Entity/MissionCategory.php b/src/Entity/MissionCategory.php index 76a4d1c..862d5a8 100644 --- a/src/Entity/MissionCategory.php +++ b/src/Entity/MissionCategory.php @@ -17,4 +17,26 @@ class MissionCategory #[ORM\OneToMany(targetEntity: Category::class, mappedBy: 'MissionCategory')] #[ORM\JoinColumn(nullable: false)] private ?Category $category = null; + + public function getMission(): ?Mission + { + return $this->mission; + } + + public function setMission(?Mission $mission): void + { + $this->mission = $mission; + } + + public function getCategory(): ?Category + { + return $this->category; + } + + public function setCategory(?Category $category): void + { + $this->category = $category; + } + + } diff --git a/src/Entity/Representation.php b/src/Entity/Representation.php index 9be8220..71a49be 100644 --- a/src/Entity/Representation.php +++ b/src/Entity/Representation.php @@ -20,6 +20,9 @@ class Representation #[ORM\Column] private ?int $count = null; + #[ORM\Column] + private ?\DateTime $date = null; + public function getCount(): ?int { return $this->count; @@ -30,9 +33,6 @@ class Representation $this->count = $count; } - #[ORM\Column] - private ?\DateTime $date = null; - public function getDate(): ?\DateTime { return $this->date; @@ -42,4 +42,27 @@ class Representation { $this->date = $date; } + + public function getEmployee(): ?Employee + { + return $this->employee; + } + + public function setEmployee(?Employee $employee): void + { + $this->employee = $employee; + } + + public function getRide(): ?Ride + { + return $this->ride; + } + + public function setRide(?Ride $ride): void + { + $this->ride = $ride; + } + + + } diff --git a/src/Entity/Requirement.php b/src/Entity/Requirement.php index a69c4a5..5009c0b 100644 --- a/src/Entity/Requirement.php +++ b/src/Entity/Requirement.php @@ -5,8 +5,8 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Table(name: 'Requirements')] -class Requirements +#[ORM\Table(name: 'Requirement')] +class Requirement { #[ORM\Id] #[ORM\OneToMany(targetEntity: Mission::class, mappedBy: 'requirements')] @@ -17,4 +17,27 @@ class Requirements #[ORM\OneToMany(targetEntity: Skill::class, mappedBy: 'requirements')] #[ORM\JoinColumn(nullable: false)] private ?Skill $skill = null; + + public function getMission(): ?Mission + { + return $this->mission; + } + + public function setMission(?Mission $mission): void + { + $this->mission = $mission; + } + + public function getSkill(): ?Skill + { + return $this->skill; + } + + public function setSkill(?Skill $skill): void + { + $this->skill = $skill; + } + + + } diff --git a/src/Entity/Ride.php b/src/Entity/Ride.php index 9b003b8..93d2433 100644 --- a/src/Entity/Ride.php +++ b/src/Entity/Ride.php @@ -2,6 +2,7 @@ namespace App\Entity; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -18,6 +19,40 @@ class Ride #[ORM\Column] private ?int $count = null; + #[ORM\ManyToOne(targetEntity: Assignment::class, inversedBy: 'ride')] + private Collection $assignments; + + #[ORM\ManyToOne(targetEntity: Representation::class, inversedBy: 'ride')] + private Collection $representations; + + #[ORM\ManyToOne(targetEntity: IncidentType::class, inversedBy: 'ride')] + private Collection $incidentTypes; + + #[ORM\ManyToOne(targetEntity: Mission::class, inversedBy: 'ride')] + private Collection $missions; + + public function getAssignments(): Collection + { + return $this->assignments; + } + + public function setAssignments(Collection $assignments): void + { + $this->assignments = $assignments; + } + + public function getRepresentations(): Collection + { + return $this->representations; + } + + public function setRepresentations(Collection $representations): void + { + $this->representations = $representations; + } + + + public function getId(): ?int { return $this->id; @@ -53,4 +88,26 @@ class Ride return $this; } + + public function getIncidentTypes(): Collection + { + return $this->incidentTypes; + } + + public function setIncidentTypes(Collection $incidentTypes): void + { + $this->incidentTypes = $incidentTypes; + } + + public function getMissions(): Collection + { + return $this->missions; + } + + public function setMissions(Collection $missions): void + { + $this->missions = $missions; + } + + } diff --git a/src/Entity/Skill.php b/src/Entity/Skill.php index df0a435..6561f86 100644 --- a/src/Entity/Skill.php +++ b/src/Entity/Skill.php @@ -2,7 +2,7 @@ namespace App\Entity; - +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -16,8 +16,32 @@ class Skill #[ORM\Column(length: 30)] private ?string $label = null; - #[ORM\ManyToOne(targetEntity: Requirements::class, inversedBy: 'skills')] - private ?Requirements $requirements = null; + #[ORM\ManyToOne(targetEntity: Requirement::class, inversedBy: 'skill')] + private Collection $requirements; + + #[ORM\ManyToOne(targetEntity: EmployeeSkill::class, inversedBy: 'skill')] + private Collection $employeeskills; + + public function getRequirements(): Collection + { + return $this->requirements; + } + + public function setRequirements(Collection $requirements): void + { + $this->requirements = $requirements; + } + + public function getEmployeeskills(): Collection + { + return $this->employeeskills; + } + + public function setEmployeeskills(Collection $employeeskills): void + { + $this->employeeskills = $employeeskills; + } + public function getId(): ?int { @@ -43,4 +67,5 @@ class Skill return $this; } + }