Spookie/src/Entity/Projects.php

140 lines
2.8 KiB
PHP
Raw Normal View History

2022-04-11 16:05:12 +02:00
<?php
namespace App\Entity;
2022-05-03 14:52:04 +02:00
use ApiPlatform\Core\Annotation\ApiResource;
2022-04-11 16:05:12 +02:00
use App\Repository\ProjectsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProjectsRepository::class)]
2022-05-03 14:52:04 +02:00
#[ApiResource]
2022-05-11 14:48:04 +02:00
class Projects implements \Stringable
2022-04-11 16:05:12 +02:00
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
2022-05-11 14:48:04 +02:00
private ?int $id = null;
2022-04-11 16:05:12 +02:00
#[ORM\Column(type: 'string', length: 255)]
2022-05-11 14:48:04 +02:00
private ?string $name = null;
2022-04-11 16:05:12 +02:00
#[ORM\Column(type: 'string', length: 255)]
2022-05-11 14:48:04 +02:00
private ?string $description = null;
2022-04-11 16:05:12 +02:00
#[ORM\Column(type: 'string', length: 255)]
2022-05-11 14:48:04 +02:00
private ?string $url = null;
2022-04-11 16:05:12 +02:00
#[ORM\Column(type: 'datetime_immutable')]
2022-05-11 14:48:04 +02:00
private ?\DateTimeImmutable $createdAt = null;
2022-04-11 16:05:12 +02:00
#[ORM\Column(type: 'string', length: 255, nullable: true)]
2022-05-11 14:48:04 +02:00
private ?string $teaserImage = null;
2022-04-11 16:05:12 +02:00
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'projects')]
private $developer;
public function __construct()
{
$this->developer = new ArrayCollection();
}
2022-05-03 14:52:04 +02:00
/**
* @return string|null
*/
2022-05-11 14:48:04 +02:00
public function __toString(): string
2022-05-03 14:52:04 +02:00
{
2022-05-11 14:48:04 +02:00
return (string) $this->name;
2022-05-03 14:52:04 +02:00
}
public function getId(): ?int
2022-04-11 16:05:12 +02:00
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $Name): self
{
$this->name = $Name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $Description): self
{
$this->description = $Description;
return $this;
}
public function getURL(): ?string
{
return $this->url;
}
public function setURL(string $url): self
{
$this->url = $url;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getTeaserImage(): ?string
{
return $this->teaserImage;
}
public function setTeaserImage(?string $teaserImage): self
{
$this->teaserImage = $teaserImage;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getDeveloper(): Collection
{
return $this->developer;
}
public function addDeveloper(User $developer): self
{
if (!$this->developer->contains($developer)) {
$this->developer[] = $developer;
}
return $this;
}
public function removeDeveloper(User $developer): self
{
$this->developer->removeElement($developer);
return $this;
}
}