diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index 3cab672..edabbae 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -1,6 +1,7 @@ api_platform: title: Architetture Roma - API version: beta + show_webby: false defaults: stateless: true cache_headers: diff --git a/src/Entity/Degradation.php b/src/Entity/Degradation.php new file mode 100644 index 0000000..bf4eb0a --- /dev/null +++ b/src/Entity/Degradation.php @@ -0,0 +1,91 @@ + 'degradation:item']), + new GetCollection(normalizationContext: ['groups' => 'degradation:list']) + ], + order: ['term' => 'DESC'], + paginationEnabled: false, +)] +class Degradation +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + #[Groups(['degradation:list', 'degradation:item'])] + private ?int $id = null; + + #[ORM\Column(length: 50, name: 'lemma')] + #[Groups(['degradation:list', 'degradation:item'])] + private ?string $term = null; + + #[ORM\Column(length: 50, nullable: true, name: 'classe')] + #[Groups(['degradation:list', 'degradation:item'])] + private ?string $class = null; + + #[ORM\Column(type: Types::BIGINT, nullable: true, name: 'materiale')] + //#[ORM\ManyToOne()] + #[Groups(['degradation:list', 'degradation:item'])] + private ?string $material = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(string $id): static + { + $this->id = $id; + + return $this; + } + + public function getTerm(): ?string + { + return $this->term; + } + + public function setTerm(string $term): static + { + $this->term = $term; + + return $this; + } + + public function getClass(): ?string + { + return $this->class; + } + + public function setClass(?string $class): static + { + $this->class = $class; + + return $this; + } + + public function getMaterial(): ?string + { + return $this->material; + } + + public function setMaterial(?string $material): static + { + $this->material = $material; + + return $this; + } +} diff --git a/src/Entity/Material.php b/src/Entity/Material.php new file mode 100644 index 0000000..74e0f3a --- /dev/null +++ b/src/Entity/Material.php @@ -0,0 +1,42 @@ +id; + } + + public function setId(string $id): static + { + $this->id = $id; + + return $this; + } + + public function getTerm(): ?string + { + return $this->term; + } + + public function setTerm(string $term): static + { + $this->term = $term; + + return $this; + } +} diff --git a/src/Repository/DegradationRepository.php b/src/Repository/DegradationRepository.php new file mode 100644 index 0000000..833f0a1 --- /dev/null +++ b/src/Repository/DegradationRepository.php @@ -0,0 +1,43 @@ + + */ +class DegradationRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Degradation::class); + } + + // /** + // * @return Degradation[] Returns an array of Degradation objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('d') + // ->andWhere('d.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('d.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Degradation + // { + // return $this->createQueryBuilder('d') + // ->andWhere('d.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/src/Repository/MaterialRepository.php b/src/Repository/MaterialRepository.php new file mode 100644 index 0000000..0d4a7ff --- /dev/null +++ b/src/Repository/MaterialRepository.php @@ -0,0 +1,43 @@ + + */ +class MaterialRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Material::class); + } + + // /** + // * @return Material[] Returns an array of Material objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('m.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Material + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +}