Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlada1356277 authored Mar 20, 2023
1 parent f15f136 commit 4043500
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions CRUD Symfony + API Platform/class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\ApiResource;

/**
* @ApiResource(
* collectionOperations={
* "get",
* "post"
* },
* itemOperations={
* "get",
* "put",
* "delete",
* "patch"
* }
* )
* @ORM\Entity()
* @ORM\Table(name="toys")
*/

// описываем класс Toy с атрибутами id, name, price, description. Прописываем геттеры и сеттеры атрибутов
class Toy
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;

/**
* @ORM\Column(type="string", length=255)
*/
private $name;

/**
* @ORM\Column(type="integer")
*/
private $price;

/**
* @ORM\Column(type="text")
*/
private $description;

public function getId(): ?int
{
return $this->id;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

public function getPrice(): ?int
{
return $this->price;
}

public function setPrice(int $price): self
{
$this->price = $price;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(string $description): self
{
$this->description = $description;

return $this;
}
}

0 comments on commit 4043500

Please sign in to comment.