src/Entity/RecordSocialMedia.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RecordSocialMediaRepository;
  4. use App\Traits\Timestamps;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassRecordSocialMediaRepository::class)]
  10. #[ORM\InheritanceType("SINGLE_TABLE")]
  11. #[ORM\DiscriminatorColumn(name"discr"type"string"length3)]
  12. #[ORM\DiscriminatorMap(["FCB" => RecordFacebook::class,"INS" => RecordInstagram::class,"TWI" => RecordTwitter::class,"YOU" => RecordYoutube::class,"TIK" => RecordTiktok::class])]
  13. #[ORM\HasLifecycleCallbacks]
  14. class RecordSocialMedia
  15. {
  16.     use Timestamps;
  17.     const REACH_METRIC_NAME 'post_impressions_fan_unique';
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\ManyToOne(fetch'EAGER',inversedBy'recordSocialMedia')]
  23.     private ?SocialMedia $socialMedia null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $engagement null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $reach null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $totalFollowers null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $interaction null;
  32.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  33.     private ?\DateTimeInterface $date null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $postsCount null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $postsPerDay null;
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $paidReach null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $organicReach null;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?int $postsLikes 0;
  44.     #[ORM\Column(nullabletrue)]
  45.     private ?int $videoPostCount null;
  46.     #[ORM\Column(nullabletrue)]
  47.     private ?int $ReelsShortsPostCount null;
  48.     #[ORM\Column(nullabletrue)]
  49.     private ?int $picturePostCount null;
  50.     #[ORM\OneToMany(mappedBy'record'targetEntityPostRecord::class,cascade: ['persist'], orphanRemovaltrue)]
  51.     private Collection $postRecords;
  52.     #[ORM\Column(nullabletrue)]
  53.     private ?int $postInteraction null;
  54.     #[ORM\Column(nullabletrue)]
  55.     private ?int $impressions null;
  56.     #[ORM\Column(nullabletrue)]
  57.     private ?int $pageViews null;
  58.     public function __construct()
  59.     {
  60.         $this->postRecords = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getSocialMedia(): ?SocialMedia
  67.     {
  68.         return $this->socialMedia;
  69.     }
  70.     public function setSocialMedia(?SocialMedia $socialMedia): static
  71.     {
  72.         $this->socialMedia $socialMedia;
  73.         return $this;
  74.     }
  75.     public function getEngagement(): ?string
  76.     {
  77.         return $this->engagement;
  78.     }
  79.     public function setEngagement(?string $engagement): static
  80.     {
  81.         $this->engagement $engagement;
  82.         return $this;
  83.     }
  84.     public function getReach(): ?string
  85.     {
  86.         return $this->reach;
  87.     }
  88.     public function setReach(?string $reach): static
  89.     {
  90.         $this->reach $reach;
  91.         return $this;
  92.     }
  93.     public function getTotalFollowers(): ?string
  94.     {
  95.         return $this->totalFollowers;
  96.     }
  97.     public function setTotalFollowers(?string $totalFollowers): static
  98.     {
  99.         $this->totalFollowers $totalFollowers;
  100.         return $this;
  101.     }
  102.     public function getInteraction(): ?string
  103.     {
  104.         return $this->interaction;
  105.     }
  106.     public function setInteraction(?string $interaction): static
  107.     {
  108.         $this->interaction $interaction;
  109.         return $this;
  110.     }
  111.     public function getDate(): ?\DateTimeInterface
  112.     {
  113.         return $this->date;
  114.     }
  115.     public function setDate(\DateTimeInterface $date): static
  116.     {
  117.         $this->date $date;
  118.         return $this;
  119.     }
  120.     public function getPostsCount(): ?string
  121.     {
  122.         return $this->postsCount;
  123.     }
  124.     public function setPostsCount(?string $postsCount): static
  125.     {
  126.         $this->postsCount $postsCount;
  127.         return $this;
  128.     }
  129.     public function getPostsPerDay(): ?string
  130.     {
  131.         return $this->postsPerDay;
  132.     }
  133.     public function setPostsPerDay(?string $postsPerDay): static
  134.     {
  135.         $this->postsPerDay $postsPerDay;
  136.         return $this;
  137.     }
  138.     public function getPaidReach(): ?string
  139.     {
  140.         return $this->paidReach;
  141.     }
  142.     public function setPaidReach(?string $paidReach): static
  143.     {
  144.         $this->paidReach $paidReach;
  145.         return $this;
  146.     }
  147.     public function getOrganicReach(): ?string
  148.     {
  149.         return $this->organicReach;
  150.     }
  151.     public function setOrganicReach(?string $organicReach): static
  152.     {
  153.         $this->organicReach $organicReach;
  154.         return $this;
  155.     }
  156.     public function getPostsLikes(): ?int
  157.     {
  158.         return $this->postsLikes;
  159.     }
  160.     public function setPostsLikes(?int $postsLikes): static
  161.     {
  162.         $this->postsLikes $postsLikes;
  163.         return $this;
  164.     }
  165.     public function getVideoPostCount(): ?int
  166.     {
  167.         return $this->videoPostCount;
  168.     }
  169.     public function setVideoPostCount(?int $videoPostCount): static
  170.     {
  171.         $this->videoPostCount $videoPostCount;
  172.         return $this;
  173.     }
  174.     public function getReelsShortsPostCount(): ?int
  175.     {
  176.         return $this->ReelsShortsPostCount;
  177.     }
  178.     public function setReelsShortsPostCount(?int $ReelsShortsPostCount): static
  179.     {
  180.         $this->ReelsShortsPostCount $ReelsShortsPostCount;
  181.         return $this;
  182.     }
  183.     public function getPicturePostCount(): ?int
  184.     {
  185.         return $this->picturePostCount;
  186.     }
  187.     public function setPicturePostCount(?int $picturePostCount): static
  188.     {
  189.         $this->picturePostCount $picturePostCount;
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection<int, PostRecord>
  194.      */
  195.     public function getPostRecords(): Collection
  196.     {
  197.         return $this->postRecords;
  198.     }
  199.     public function addPostRecord(PostRecord $postRecord): static
  200.     {
  201.         if (!$this->postRecords->contains($postRecord)) {
  202.             $this->postRecords->add($postRecord);
  203.             $postRecord->setRecord($this);
  204.         }
  205.         return $this;
  206.     }
  207.     public function removePostRecord(PostRecord $postRecord): static
  208.     {
  209.         if ($this->postRecords->removeElement($postRecord)) {
  210.             // set the owning side to null (unless already changed)
  211.             if ($postRecord->getRecord() === $this) {
  212.                 $postRecord->setRecord(null);
  213.             }
  214.         }
  215.         return $this;
  216.     }
  217.     public function getPostInteraction(): ?int
  218.     {
  219.         return $this->postInteraction;
  220.     }
  221.     public function setPostInteraction(?int $postInteraction): static
  222.     {
  223.         $this->postInteraction $postInteraction;
  224.         return $this;
  225.     }
  226.     public function isFacebook(): bool
  227.     {
  228.         return false;
  229.     }
  230.     public function isTiktok(): bool
  231.     {
  232.         return false;
  233.     }
  234.     public function isTwitter(): bool
  235.     {
  236.         return false;
  237.     }
  238.     public function isInstagram(): bool
  239.     {
  240.         return false;
  241.     }
  242.     public function isYoutube(): bool
  243.     {
  244.         return false;
  245.     }
  246.     public function getReachMetricName(): ?string
  247.     {
  248.         return self::REACH_METRIC_NAME;
  249.     }
  250.     public function getImpressions(): ?int
  251.     {
  252.         return $this->impressions;
  253.     }
  254.     public function setImpressions(?int $impressions): static
  255.     {
  256.         $this->impressions $impressions;
  257.         return $this;
  258.     }
  259.     public function getPageViews(): ?int
  260.     {
  261.         return $this->pageViews;
  262.     }
  263.     public function setPageViews(?int $pageViews): static
  264.     {
  265.         $this->pageViews $pageViews;
  266.         return $this;
  267.     }
  268.     public function getNetwork(): ?string
  269.     {
  270.         return $this->getSocialMedia()->getNetwork();
  271.     }
  272. }