added type annotations
This commit is contained in:
parent
1120f1798f
commit
3e20a9c644
|
@ -2,56 +2,38 @@
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use ApiPlatform\Core\Annotation\ApiFilter;
|
|
||||||
use ApiPlatform\Core\Annotation\ApiResource;
|
|
||||||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
|
|
||||||
use App\Repository\PagesRepository;
|
use App\Repository\PagesRepository;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Sunrise\Slugger\Slugger;
|
use Sunrise\Slugger\Slugger;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: PagesRepository::class), ORM\HasLifecycleCallbacks]
|
#[ORM\Entity(repositoryClass: PagesRepository::class), ORM\HasLifecycleCallbacks]
|
||||||
#[ApiResource]
|
|
||||||
#[ApiFilter(filterClass: SearchFilter::class, properties: ['slug' => 'exact'])]
|
|
||||||
|
|
||||||
class Pages
|
class Pages
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\GeneratedValue]
|
#[ORM\GeneratedValue]
|
||||||
#[ORM\Column(type: 'integer')]
|
#[ORM\Column(type: 'integer')]
|
||||||
private $id;
|
private ?int $id;
|
||||||
|
|
||||||
#[ORM\Column(type: 'string', length: 255)]
|
#[ORM\Column(type: 'string', length: 255)]
|
||||||
private $name;
|
private string $name;
|
||||||
|
|
||||||
#[ORM\Column(type: 'text')]
|
#[ORM\Column(type: 'text')]
|
||||||
private $content;
|
private string $content;
|
||||||
|
|
||||||
#[ORM\Column(type: 'datetime_immutable')]
|
#[ORM\Column(type: 'datetime_immutable')]
|
||||||
private $createdAt;
|
private ?DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
|
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
|
||||||
private $modifiedAt;
|
private ?DateTimeImmutable $modifiedAt;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'pages')]
|
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'pages')]
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private $owner;
|
private User $owner;
|
||||||
|
|
||||||
#[ORM\Column(type: 'string', length: 255)]
|
#[ORM\Column(type: 'string', length: 255)]
|
||||||
private $slug;
|
private string $slug;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $id
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* public function __construct(String $name = '', String $content = '')
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
$this->content = $content;
|
|
||||||
$owner = $userRepository->findOneBy(['username' => 'tracer']);
|
|
||||||
$this->owner = $owner;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue