<?php
namespace Nellapp\Bundle\SDKBundle\ActivityFeed\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelInterface;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Serializer\Annotation as Serial;
#[ORM\MappedSuperclass]
abstract class AbstractActivityFeed implements ActivityFeedInterface
{
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
protected ?int $id = null;
#[ORM\OneToMany(mappedBy: 'activityFeed', targetEntity: ActivityInterface::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
protected Collection $activities;
#[ORM\ManyToOne(targetEntity: ChannelInterface::class, fetch: 'EAGER')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
protected ?ChannelInterface $channel = null;
public function __construct()
{
$this->activities = new ArrayCollection();
}
public static function getPermissionResourceClass(): ?string
{
return null;
}
public function getOwnerChannel(): ?ChannelInterface
{
return $this->getChannel();
}
public function __toString(): string
{
return '';
}
#[Serial\Groups(['GlobalJSVariable'])]
public function getId(): ?int
{
return $this->id;
}
public function getActivities(): Collection
{
return $this->activities;
}
public function addActivity(ActivityInterface $activity): static
{
if (!$this->getActivities()->contains($activity)) {
$this->getActivities()->add($activity);
}
return $this;
}
public function removeActivity(ActivityInterface $activity): static
{
if ($this->getActivities()->contains($activity)) {
$this->getActivities()->removeElement($activity);
}
return $this;
}
public function setActivities(Collection $activities): static
{
$this->activities = $activities;
return $this;
}
public function getChannel(): ?ChannelInterface
{
return $this->channel;
}
public function setChannel(?ChannelInterface $channel): static
{
$this->channel = $channel;
return $this;
}
}