added type annotations

This commit is contained in:
tracer 2022-11-03 19:15:26 +01:00
parent 1120f1798f
commit 3e20a9c644
1 changed files with 7 additions and 25 deletions

View File

@ -2,56 +2,38 @@
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 DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Sunrise\Slugger\Slugger;
#[ORM\Entity(repositoryClass: PagesRepository::class), ORM\HasLifecycleCallbacks]
#[ApiResource]
#[ApiFilter(filterClass: SearchFilter::class, properties: ['slug' => 'exact'])]
class Pages
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
private ?int $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
private string $name;
#[ORM\Column(type: 'text')]
private $content;
private string $content;
#[ORM\Column(type: 'datetime_immutable')]
private $createdAt;
private ?DateTimeImmutable $createdAt;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $modifiedAt;
private ?DateTimeImmutable $modifiedAt;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'pages')]
#[ORM\JoinColumn(nullable: false)]
private $owner;
private User $owner;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
/**
* @param $id
*/
/* public function __construct(String $name = '', String $content = '')
{
$this->name = $name;
$this->content = $content;
$owner = $userRepository->findOneBy(['username' => 'tracer']);
$this->owner = $owner;
}
*/
private string $slug;
public function getId(): ?int
{