src/Entity/Activity.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActivityRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation\ExclusionPolicy;
  8. use JMS\Serializer\Annotation\Expose;
  9. #[ORM\Entity(repositoryClass: ActivityRepository::class)]
  10. #[ORM\Table(name: 'activity')]
  11. class Activity {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type: 'integer')]
  15.     private ?int $id = null;
  16.     #[ORM\Column(name: 'name', type: 'string', length: 255, unique: false, nullable: true)]
  17.     private string $name;
  18.     #[ORM\Column(name: 'description', type: 'text', nullable: true)]
  19.     private ?string $description;
  20.     #[ORM\ManyToOne(targetEntity: SectorArea::class, inversedBy: 'activities')]
  21.     #[ORM\JoinColumn(name: 'id_sectorArea', referencedColumnName: 'id')]
  22.     private SectorArea $sectorArea;
  23.     #[ORM\OneToMany(mappedBy: 'activity', targetEntity: Country::class)]
  24.     private Collection $country;
  25.     public function __construct() {
  26.         $this->country = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int {
  29.         return $this->id;
  30.     }
  31.     public function setName(string $name): self {
  32.         $this->name = $name;
  33.         return $this;
  34.     }
  35.     public function getName(): string {
  36.         return $this->name;
  37.     }
  38.     public function setDescription(?string $description): self {
  39.         $this->description = $description;
  40.         return $this;
  41.     }
  42.     public function getDescription(): ?string {
  43.         return $this->description;
  44.     }
  45.     public function setSectorArea(SectorArea $sectorArea = null): self {
  46.         $this->sectorArea = $sectorArea;
  47.         return $this;
  48.     }
  49.     public function getSectorArea(): SectorArea {
  50.         return $this->sectorArea;
  51.     }
  52.     public function addCountry(Country $country): self {
  53.         $this->country->add($country);
  54.         return $this;
  55.     }
  56.     public function removeCountry(Country $country): void {
  57.         $this->country->removeElement($country);
  58.     }
  59.     public function getCountry(): Collection {
  60.         return $this->country;
  61.     }
  62.     public function __toString() {
  63.         return $this->name;
  64.     }
  65. }