<?php
declare(strict_types=1);
namespace App\Entity\User;
use App\Entity\LicenceFile;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\MappedSuperclass;
use Doctrine\ORM\Mapping\Table;
use Sylius\Component\Core\Model\ShopUser as BaseShopUser;
use Sylius\Component\Core\Model\ShopUserInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
* @Table(name="sylius_shop_user")
*/
class ShopUser extends BaseShopUser implements ShopUserInterface
{
/**
* @ORM\OneToMany(targetEntity="App\Entity\LicenceFile", mappedBy="user", orphanRemoval=true)
*/
private $licenceFiles;
public function __construct()
{
parent::__construct();
$this->licenceFiles = new ArrayCollection();
}
/**
* @return Collection|LicenceFile[]
*/
public function getLicenceFiles(): Collection
{
return $this->licenceFiles;
}
public function addLicenceFile(LicenceFile $licenceFile): self
{
if (!$this->licenceFiles->contains($licenceFile)) {
$this->licenceFiles[] = $licenceFile;
$licenceFile->setUser($this);
}
return $this;
}
public function removeLicenceFile(LicenceFile $licenceFile): self
{
if ($this->licenceFiles->contains($licenceFile)) {
$this->licenceFiles->removeElement($licenceFile);
// set the owning side to null (unless already changed)
if ($licenceFile->getUser() === $this) {
$licenceFile->setUser(null);
}
}
return $this;
}
}