Skip to content

Commit

Permalink
Add CRUD about books
Browse files Browse the repository at this point in the history
Following step https://api-platform.com/docs/distribution/#bringing-your-own-model

Specs from api/src/Entity/Greeting.php had to be removed too.
  • Loading branch information
Polo2 committed Sep 19, 2023
1 parent 111ecdd commit f8ca34f
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 134 deletions.
26 changes: 26 additions & 0 deletions api/src/Entity/Book.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
// api/src/Entity/Book.php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
/** A book. */
#[ApiResource]
class Book
{
/** The ID of this book. */
private ?int $id = null;
/** The ISBN of this book (or null if doesn't have one). */
public ?string $isbn = null;
/** The title of this book. */
public string $title = '';
/** The description of this book. */
public string $description = '';
/** The author of this book. */
public string $author = '';
/** The publication date of this book. */
public ?\DateTimeImmutable $publicationDate = null;
public function getId(): ?int
{
return $this->id;
}
}
35 changes: 0 additions & 35 deletions api/src/Entity/Greeting.php

This file was deleted.

22 changes: 0 additions & 22 deletions api/tests/Api/GreetingsTest.php

This file was deleted.

Loading

0 comments on commit f8ca34f

Please sign in to comment.