<?php
namespace App\Entity;
use App\Repository\SubscriptionStatusRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SubscriptionStatusRepository::class)
*/
class SubscriptionStatus
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
public function __toString()
{
return $this->content;
}
/**
* @ORM\Column(type="string", length=255)
*/
private $content;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="subscriptionStatus")
*/
private $users;
public function __construct()
{
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setSubscriptionStatus($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getSubscriptionStatus() === $this) {
$user->setSubscriptionStatus(null);
}
}
return $this;
}
}