<?php
namespace App\Entity\Account;
use App\Entity\Saloon\Saloon;
use App\Entity\Profile\Profile;
use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
#[ORM\Entity]
class Advertiser extends User
{
public const ROLE_ADVERTISER = 'ROLE_ADVERTISER';
#[ORM\OneToMany(targetEntity: PhoneReviewAdded::class, mappedBy: 'user', cascade: ['all'])]
private Collection $phoneReviewsAdded;
/** @var Profile[] */
#[ORM\OneToMany(targetEntity: Profile::class, mappedBy: 'owner')]
private Collection $profiles;
/** @var Saloon[] */
#[ORM\OneToMany(targetEntity: Saloon::class, mappedBy: 'owner')]
private Collection $saloons;
public function __construct()
{
parent::__construct();
$this->profiles = new ArrayCollection();
$this->saloons = new ArrayCollection();
$this->phoneReviewsAdded = new ArrayCollection();
$this->setRoles(array_merge($this->getRoles(), [self::ROLE_ADVERTISER]));
}
public function getProfiles(): Collection
{
return $this->profiles;
}
public function addProfile(Profile $profile): void
{
if (!$this->profiles->contains($profile)) {
$this->profiles->add($profile);
}
}
public function removeProfile(Profile $profile): void
{
$this->profiles->removeElement($profile);
}
/**
* @return Saloon[]
*/
public function getSaloons(): Collection
{
return $this->saloons;
}
public function addSaloon(Saloon $saloon): void
{
if (!$this->saloons->contains($saloon)) {
$this->saloons->add($saloon);
}
}
public function removeSaloon(Saloon $saloon): void
{
$this->saloons->removeElement($saloon);
}
public function getPhoneReviewsAdded(): Collection
{
return $this->phoneReviewsAdded;
}
public function __toString(): string
{
return (string)$this->getId();
}
}