src/Entity/Goal.php line 19

  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Entity\Mapped\NamedEntity;
  6. use App\Repository\GoalRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(
  9.     repositoryClassGoalRepository::class
  10. )]
  11. #[ORM\Table(
  12.     name'goal'
  13. )]
  14. #[ApiResource]
  15. class Goal extends NamedEntity
  16. {
  17.     #[ORM\ManyToOne(
  18.         targetEntityProject::class,
  19.         inversedBy'goals'
  20.     )]
  21.     #[ORM\JoinColumn(
  22.         name'project'
  23.     )]
  24.     private ?Project $project null;
  25.     #[ORM\OneToMany(
  26.         mappedBy'goal',
  27.         targetEntityIndicator::class,
  28.         cascade: ['persist'],
  29.         fetch'EXTRA_LAZY',
  30.         orphanRemovaltrue
  31.     )]
  32.     private ?iterable $indicators;
  33.     public function getProject(): ?Project
  34.     {
  35.         return $this->project;
  36.     }
  37.     public function setProject(?Project $project): self
  38.     {
  39.         $this->project $project;
  40.         return $this;
  41.     }
  42. }