Finished RelationService.php
This commit is contained in:
commit
76b4d05620
@ -14,4 +14,6 @@ class DashboardController extends AbstractController
|
|||||||
{
|
{
|
||||||
return $this->render('dashboard/index.html.twig');
|
return $this->render('dashboard/index.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
18
src/Controller/EmployeeController.php
Normal file
18
src/Controller/EmployeeController.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
class EmployeeController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/employee', name: 'app_employee')]
|
||||||
|
public function index(): Response
|
||||||
|
{
|
||||||
|
return $this->render('employee/index.html.twig', [
|
||||||
|
'controller_name' => 'EmployeeController',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
61
src/Service/RelationService.php
Normal file
61
src/Service/RelationService.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Service;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Entity\Assignment;
|
||||||
|
use App\Entity\Category;
|
||||||
|
use App\Entity\Employee;
|
||||||
|
use App\Entity\EmployeeSkill;
|
||||||
|
use App\Entity\Mission;
|
||||||
|
use App\Entity\MissionCategory;
|
||||||
|
use App\Entity\Representation;
|
||||||
|
use App\Entity\Requirement;
|
||||||
|
use App\Entity\Ride;
|
||||||
|
use App\Entity\Skill;
|
||||||
|
|
||||||
|
class RelationService {
|
||||||
|
public function setAssignment(Ride $ride, Employee $employee, \DateTime $startHour, \DateTime $endHour )
|
||||||
|
{
|
||||||
|
$assignment = new Assignment();
|
||||||
|
|
||||||
|
$assignment->setEmployee($employee);
|
||||||
|
$assignment->setRide($ride);
|
||||||
|
$assignment->setStartHour($startHour);
|
||||||
|
$assignment->setEndHour($endHour);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEmployeeSkill(Skill $skill, Employee $employee )
|
||||||
|
{
|
||||||
|
$employeeSkill = new EmployeeSkill();
|
||||||
|
|
||||||
|
$employeeSkill->setEmployee($employee);
|
||||||
|
$employeeSkill->setSkill($skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMissionCategory(Mission $mission, Category $category )
|
||||||
|
{
|
||||||
|
$missionCategory = new MissionCategory();
|
||||||
|
|
||||||
|
$missionCategory->setMission($mission);
|
||||||
|
$missionCategory->setCategory($category);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRepresentation(Ride $ride, Employee $employee,int $count ,\DateTime $date )
|
||||||
|
{
|
||||||
|
$representation = new Representation();
|
||||||
|
|
||||||
|
$representation->setRide($ride);
|
||||||
|
$representation->setEmployee($employee);
|
||||||
|
$representation->setCount($count);
|
||||||
|
$representation->setDate($date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRequirement(Skill $skill, Mission $mission )
|
||||||
|
{
|
||||||
|
$requirement = new Requirement();
|
||||||
|
|
||||||
|
$requirement->setSkill($skill);
|
||||||
|
$requirement->setMission($mission);
|
||||||
|
}
|
||||||
|
}
|
20
templates/employee/index.html.twig
Normal file
20
templates/employee/index.html.twig
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Hello EmployeeController!{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<style>
|
||||||
|
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
||||||
|
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="example-wrapper">
|
||||||
|
<h1>Hello {{ controller_name }}! ✅</h1>
|
||||||
|
|
||||||
|
This friendly message is coming from:
|
||||||
|
<ul>
|
||||||
|
<li>Your controller at <code>/media/astiery/DEV/Boussarie/AP/HegreLand/src/Controller/EmployeeController.php</code></li>
|
||||||
|
<li>Your template at <code>/media/astiery/DEV/Boussarie/AP/HegreLand/templates/employee/index.html.twig</code></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user