vendor/nellapp/sdk-bundle/src/ActivityFeed/Entity/AbstractActivity.php line 15

Open in your IDE?
  1. <?php
  2. namespace Nellapp\Bundle\SDKBundle\ActivityFeed\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameTrait;
  6. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation as Serial;
  9. use Nellapp\Bundle\SDKBundle\ActivityFeed\Entity\CommentActivity\CommentActivityInterface;
  10. use Nellapp\Bundle\SDKBundle\Auth\Entity\UserInterface;
  11. #[ORM\MappedSuperclass]
  12. abstract class AbstractActivity implements ActivityInterface
  13. {
  14.     use TimestampTrait;
  15.     use CreatedBlameTrait;
  16.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  17.     #[Serial\Groups(['activity:get''activity:delete'])]
  18.     protected ?int $id null;
  19.     #[ORM\ManyToOne(targetEntityActivityFeedInterface::class, cascade: ['persist'], inversedBy'activities')]
  20.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  21.     protected ?ActivityFeedInterface $activityFeed null;
  22.     #[ORM\OneToMany(mappedBy'parent'targetEntityCommentActivityInterface::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  23.     #[Serial\Groups(['activity:get'])]
  24.     protected Collection $comments;
  25.     public function __construct() {
  26.         $this->comments = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     #[Serial\Groups(['activity:get'])]
  33.     public function getCreatedAt(): \DateTime
  34.     {
  35.         return $this->createdAt ? : $this->createdAt = new \DateTime();
  36.     }
  37.     #[Serial\Groups(['activity:get'])]
  38.     public function getCreatedBy(): ?UserInterface
  39.     {
  40.         return $this->createdBy;
  41.     }
  42.     public function getActivityFeed(): ?ActivityFeedInterface
  43.     {
  44.         return $this->activityFeed;
  45.     }
  46.     public function setActivityFeed(?ActivityFeedInterface $activityFeed): static
  47.     {
  48.         $this->activityFeed $activityFeed;
  49.         return $this;
  50.     }
  51.     public function getComments(): Collection
  52.     {
  53.         return $this->comments;
  54.     }
  55.     public function setComments(Collection $comments): static
  56.     {
  57.         $this->comments $comments;
  58.         return $this;
  59.     }
  60. }