60 lines
1.1 KiB
PHP
60 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use ApiPlatform\Metadata as API;
|
|
use App\Repository\ProjectRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: ProjectRepository::class)]
|
|
#[API\ApiResource]
|
|
class Project
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $title = null;
|
|
|
|
#[API\ApiProperty(writable: false)]
|
|
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Account $account = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->account = new Account;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): static
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAccount(): ?Account
|
|
{
|
|
return $this->account;
|
|
}
|
|
|
|
public function setAccount(Account $account): static
|
|
{
|
|
$this->account = $account;
|
|
|
|
return $this;
|
|
}
|
|
}
|