<?php
namespace App\Entity\Channel;
use App\Entity\Account\User;
use App\Entity\Sync\SyncableInterface;
use App\Repository\Channel\UserFromChannelRepository;
use Doctrine\ORM\Mapping as ORM;
use Drosalys\Bundle\ApiBundle\Serializer\Attributes\IdGroups;
use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameInterface;
use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameTrait;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampInterface;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampTrait;
use Nellapp\Bundle\SDKBundle\Sync\EntityKeys;
use Symfony\Component\Serializer\Annotation as Serial;
#[
ORM\Entity(repositoryClass: UserFromChannelRepository::class),
ORM\Table(name: 'channel_user_from_channels'),
]
class UserFromChannel implements CreatedTimestampInterface, CreatedBlameInterface, SyncableInterface
{
use CreatedTimestampTrait;
use CreatedBlameTrait;
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
#[Serial\Groups(['Manager', 'Sync'])]
private ?int $id = null;
#[ORM\OneToOne(inversedBy: 'userFromChannel', targetEntity: User::class)]
#[Serial\Groups(['Manager'])]
#[IdGroups(['Sync'])]
private ?User $user = null;
#[ORM\ManyToOne(targetEntity: Channel::class), ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
#[Serial\Groups(['Manager'])]
#[IdGroups(['Sync'])]
private ?Channel $channel = null;
public static function getSyncKey(): string
{
return EntityKeys::CHANNEL_USER_FROM_CHANNEL;
}
public function getSyncDisplayLabel(): string
{
return $this->getUser();
}
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
public function getChannel(): ?Channel
{
return $this->channel;
}
public function setChannel(?Channel $channel): static
{
$this->channel = $channel;
return $this;
}
}