diff --git a/Dockerfile b/Dockerfile index 2a546e8..0bd3231 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,6 @@ RUN composer run-script post-install-cmd \ COPY entrypoint.sh /usr/local/bin/entrypoint RUN chmod +x /usr/local/bin/entrypoint -ENTRYPOINT ["entrypoint"] ENTRYPOINT ["entrypoint"] CMD ["frankenphp", "run", "--config", "/etc/caddy/Caddyfile"] diff --git a/migrations/Version20260812160210.php b/migrations/Version20260812160210.php new file mode 100644 index 0000000..96d17d6 --- /dev/null +++ b/migrations/Version20260812160210.php @@ -0,0 +1,31 @@ +render('excercise_session/index.html.twig', [ + 'controller_name' => 'ExcerciseSessionController', + ]); + } +} diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php deleted file mode 100644 index d9e4d1e..0000000 --- a/src/Controller/HomeController.php +++ /dev/null @@ -1,19 +0,0 @@ -Symfony is running in FrankenPHP 🎉' - ); - } -} diff --git a/src/Controller/HomePageController.php b/src/Controller/HomePageController.php new file mode 100644 index 0000000..1c6db02 --- /dev/null +++ b/src/Controller/HomePageController.php @@ -0,0 +1,18 @@ +render('home_page/index.html.twig', [ + 'controller_name' => 'HomePageController', + ]); + } +} diff --git a/src/Controller/WeatherForecastController.php b/src/Controller/WeatherForecastController.php new file mode 100644 index 0000000..2390140 --- /dev/null +++ b/src/Controller/WeatherForecastController.php @@ -0,0 +1,18 @@ +render('weather_forecast/index.html.twig', [ + 'controller_name' => 'WeatherForecastController', + ]); + } +} diff --git a/src/Entity/ExerciseSession.php b/src/Entity/ExerciseSession.php new file mode 100644 index 0000000..12615df --- /dev/null +++ b/src/Entity/ExerciseSession.php @@ -0,0 +1,163 @@ +id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getType(): ?string + { + return $this->type; + } + + public function setType(?string $type): static + { + $this->type = $type; + + return $this; + } + + public function getStartedAt(): ?\DateTimeImmutable + { + return $this->startedAt; + } + + public function setStartedAt(\DateTimeImmutable $startedAt): static + { + $this->startedAt = $startedAt; + + return $this; + } + + public function getEndedAt(): ?\DateTimeImmutable + { + return $this->endedAt; + } + + public function setEndedAt(?\DateTimeImmutable $endedAt): static + { + $this->endedAt = $endedAt; + + return $this; + } + + public function getDuration(): ?int + { + return $this->duration; + } + + public function setDuration(int $duration): static + { + $this->duration = $duration; + + return $this; + } + + public function getDistance(): ?string + { + return $this->distance; + } + + public function setDistance(string $distance): static + { + $this->distance = $distance; + + return $this; + } + + public function getCalories(): ?int + { + return $this->calories; + } + + public function setCalories(int $calories): static + { + $this->calories = $calories; + + return $this; + } + + public function getNotes(): ?string + { + return $this->notes; + } + + public function setNotes(?string $notes): static + { + $this->notes = $notes; + + return $this; + } + + public function getSource(): ?string + { + return $this->source; + } + + public function setSource(string $source): static + { + $this->source = $source; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->createdAt; + } + + public function setCreatedAt(\DateTimeImmutable $createdAt): static + { + $this->createdAt = $createdAt; + + return $this; + } +} diff --git a/src/Form/ExcerciseSessionFormType.php b/src/Form/ExcerciseSessionFormType.php new file mode 100644 index 0000000..4e4e189 --- /dev/null +++ b/src/Form/ExcerciseSessionFormType.php @@ -0,0 +1,39 @@ +add('type') + ->add('startedAt', null, [ + 'widget' => 'single_text', + ]) + ->add('endedAt', null, [ + 'widget' => 'single_text', + ]) + ->add('duration') + ->add('distance') + ->add('calories') + ->add('notes') + ->add('source') + ->add('createdAt', null, [ + 'widget' => 'single_text', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => ExerciseSession::class, + ]); + } +} diff --git a/src/Repository/ExerciseSessionRepository.php b/src/Repository/ExerciseSessionRepository.php new file mode 100644 index 0000000..1a9de5b --- /dev/null +++ b/src/Repository/ExerciseSessionRepository.php @@ -0,0 +1,43 @@ + + */ +class ExerciseSessionRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ExerciseSession::class); + } + + // /** + // * @return ExerciseSession[] Returns an array of ExerciseSession objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('e') + // ->andWhere('e.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('e.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?ExerciseSession + // { + // return $this->createQueryBuilder('e') + // ->andWhere('e.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/templates/excercise_session/index.html.twig b/templates/excercise_session/index.html.twig new file mode 100644 index 0000000..ced6714 --- /dev/null +++ b/templates/excercise_session/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello ExcerciseSessionController!{% endblock %} + +{% block body %} + + +
/home/jorenmartijn/symfony-k3s/src/Controller/ExcerciseSessionController.php/home/jorenmartijn/symfony-k3s/templates/excercise_session/index.html.twig/home/jorenmartijn/symfony-k3s/src/Controller/HomePageController.php/home/jorenmartijn/symfony-k3s/templates/home_page/index.html.twig/home/jorenmartijn/symfony-k3s/src/Controller/WeatherForecastController.php/home/jorenmartijn/symfony-k3s/templates/weather_forecast/index.html.twig