app/Entity/Schema/ORM/SocialNetwork.php line 18

Open in your IDE?
  1. <?php
  2. namespace Sq\Entity\Schema\ORM;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Sq\Entity\Schema\Column;
  5. /**
  6.  * SocialNetwork.
  7.  */
  8. #[ORM\Entity]
  9. #[ORM\DiscriminatorColumn(name'sn_network'type'string')]
  10. #[ORM\InheritanceType('SINGLE_TABLE')]
  11. #[ORM\DiscriminatorMap([Column\SocialNetworkNetwork::FACEBOOK => FacebookSocialProfile::class, Column\SocialNetworkNetwork::GENERIC_PROFILE => GenericSocialProfile::class, Column\SocialNetworkNetwork::GOOGLE => GoogleSocialProfile::class, Column\SocialNetworkNetwork::INSTAGRAM => InstagramSocialProfile::class, Column\SocialNetworkNetwork::LINKEDIN => LinkedInSocialProfile::class, Column\SocialNetworkNetwork::PINTEREST => PinterestSocialProfile::class, Column\SocialNetworkNetwork::THREADS => ThreadsSocialProfile::class, Column\SocialNetworkNetwork::TIKTOK => TikTokSocialProfile::class, Column\SocialNetworkNetwork::TWITTER => TwitterSocialProfile::class, Column\SocialNetworkNetwork::YOUTUBE => YouTubeSocialProfile::class, 'NULL' => SocialProfile::class])]
  12. #[ORM\Table(name'social_network')]
  13. #[ORM\Index(name'sn_m_id'columns: ['sn_m_id'])]
  14. #[ORM\UniqueConstraint(name'account_id__network'columns: ['sn_account_id''sn_network'])]
  15. abstract class SocialNetwork implements OnboardingContentInterface
  16. {
  17.     /**
  18.      * @var int
  19.      */
  20.     #[ORM\Column(name'sn_id'type'integer'nullablefalseoptions: ['unsigned' => true])]
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  23.     protected $id;
  24.     /**
  25.      * @var int | null
  26.      */
  27.     #[ORM\Column(name'sn_account_id'type'integer'nullabletrueoptions: ['unsigned' => true])]
  28.     protected $accountId;
  29.     /**
  30.      * @var Member|null
  31.      */
  32.     #[ORM\ManyToOne(targetEntityMember::class, inversedBy'socialProfiles')]
  33.     #[ORM\JoinColumn(name'sn_m_id'referencedColumnName'm_id'nullabletrue)]
  34.     protected $member;
  35.     /**
  36.      *
  37.      * @var Workspace|null
  38.      */
  39.     #[ORM\ManyToOne(targetEntityWorkspace::class, inversedBy'socialProfiles')]
  40.     #[ORM\JoinColumn(name'sn_ws_id'referencedColumnName'ws_id'nullabletrue)]
  41.     protected $workspace;
  42.     /**
  43.      * @var string|null
  44.      */
  45.     #[ORM\Column(name'sn_status'type'string'length0nullabletrueoptions: ['default' => 'active'])]
  46.     protected $status Column\SocialNetworkStatus::ACTIVE;
  47.     /**
  48.      * @var bool|null
  49.      */
  50.     #[ORM\Column(name'sn_smart_schedule'type'boolean'nullabletrue)]
  51.     protected $smartSchedule '0';
  52.     /**
  53.      * @var bool
  54.      */
  55.     #[ORM\Column(name'sn_onboarding_content'type'boolean'nullablefalse)]
  56.     protected $onboardingContent false;
  57.     /**
  58.      * @var \DateTimeInterface|null
  59.      */
  60.     #[ORM\Column(name'sn_stats_blocked_until'type'datetime'nullabletrue)]
  61.     protected $statsBlockedUntil;
  62.     /**
  63.      * @var bool|null
  64.      */
  65.     #[ORM\Column(name'sn_inbox_enabled'type'boolean'nullabletrue)]
  66.     protected $inboxEnabled false;
  67.     /**
  68.      * @var \DateTimeInterface|null
  69.      */
  70.     #[ORM\Column(name'sn_inbox_removed_date'type'datetime'nullabletrue)]
  71.     protected $inboxRemovedDate;
  72.     /**
  73.      * @var \DateTimeInterface|null
  74.      */
  75.     #[ORM\Column(name'sn_date_added'type'datetime'nullabletrue)]
  76.     protected $dateAdded;
  77.     /**
  78.      * @var \DateTimeInterface|null
  79.      */
  80.     #[ORM\Column(name'sn_date_deleted'type'datetime'nullabletrue)]
  81.     protected $dateDeleted;
  82.     #[ORM\OneToMany(targetEntityQueueMetadata::class, mappedBy'socialProfile'cascade: ['remove'], fetch'EXTRA_LAZY')]
  83.     protected $queueMetadatas;
  84.     /**
  85.      * @var CustomBitly|null
  86.      */
  87.     #[ORM\OneToOne(targetEntityCustomBitly::class, mappedBy'socialProfile')]
  88.     protected $customBitly;
  89.     #[ORM\OneToOne(targetEntityFacebook::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  90.     protected $facebook;
  91.     #[ORM\OneToOne(targetEntityGenericProfile::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  92.     protected $genericProfile;
  93.     #[ORM\OneToOne(targetEntityGoogle::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  94.     protected $google;
  95.     #[ORM\OneToOne(targetEntityInstagram::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  96.     protected $instagram;
  97.     #[ORM\OneToOne(targetEntityLinkedIn::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  98.     protected $linkedin;
  99.     #[ORM\OneToOne(targetEntityPinterest::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  100.     protected $pinterest;
  101.     #[ORM\OneToOne(targetEntityThreads::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  102.     protected $threads;
  103.     #[ORM\OneToOne(targetEntityTikTok::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  104.     protected $tiktok;
  105.     #[ORM\OneToOne(targetEntityTwitter::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  106.     protected $twitter;
  107.     #[ORM\OneToOne(targetEntityYouTube::class, mappedBy'socialProfile'fetch'EAGER'cascade: ['persist'])]
  108.     protected $youtube;
  109.     public function __construct(?Member $member, ?Workspace $workspace nullbool $isOnboardingContent false)
  110.     {
  111.         $this->member $member;
  112.         $this->workspace $workspace;
  113.         $this->dateAdded = new \DateTimeImmutable;
  114.         $this->onboardingContent $isOnboardingContent;
  115.         if ($this->workspace !== null)
  116.         {
  117.             $this->workspace->addSocialProfile($this);
  118.         }
  119.     }
  120.     public function getId(): ?int
  121.     {
  122.         return $this->id;
  123.     }
  124.     public function setAccountId(int $accountId): self
  125.     {
  126.         $this->accountId $accountId;
  127.         return $this;
  128.     }
  129.     abstract public function getAccountId(): ?int;
  130.     public function getMember(): ?Member
  131.     {
  132.         return $this->member;
  133.     }
  134.     public function getWorkspace(): Workspace
  135.     {
  136.         return $this->workspace;
  137.     }
  138.     public function setWorkspace(?Workspace $workspace): self
  139.     {
  140.         $this->workspace $workspace;
  141.         return $this;
  142.     }
  143.     public function isLegacyWithoutWorkspace(): bool
  144.     {
  145.         return $this->workspace === null;
  146.     }
  147.     abstract public function getNetwork(): ?string;
  148.     public function getStatus(): ?string
  149.     {
  150.         return $this->status;
  151.     }
  152.     public function isDeleted(): bool
  153.     {
  154.         return $this->status === Column\SocialNetworkStatus::DELETED;
  155.     }
  156.     public function getSmartSchedule(): ?bool
  157.     {
  158.         return $this->smartSchedule;
  159.     }
  160.     public function setSmartSchedule(?bool $smartSchedule): self
  161.     {
  162.         $this->smartSchedule $smartSchedule;
  163.         return $this;
  164.     }
  165.     public function getStatsBlockedUntil(): ?\DateTimeInterface
  166.     {
  167.         return $this->statsBlockedUntil;
  168.     }
  169.     public function setStatsBlockedUntil(?\DateTimeInterface $statsBlockedUntil): self
  170.     {
  171.         $this->statsBlockedUntil $statsBlockedUntil;
  172.         return $this;
  173.     }
  174.     public function getInboxEnabled(): ?bool
  175.     {
  176.         return $this->inboxEnabled;
  177.     }
  178.     public function setInboxEnabled(?bool $inboxEnabled): self
  179.     {
  180.         $this->inboxEnabled $inboxEnabled;
  181.         return $this;
  182.     }
  183.     public function getInboxRemovedDate(): ?\DateTimeInterface
  184.     {
  185.         return $this->inboxRemovedDate;
  186.     }
  187.     public function setInboxRemovedDate(?\DateTimeInterface $inboxRemovedDate): self
  188.     {
  189.         $this->inboxRemovedDate $inboxRemovedDate;
  190.         return $this;
  191.     }
  192.     public function getDateAdded(): ?\DateTimeInterface
  193.     {
  194.         return $this->dateAdded;
  195.     }
  196.     public function setDateAdded(?\DateTimeInterface $dateAdded): SocialNetwork
  197.     {
  198.         $this->dateAdded $dateAdded;
  199.         return $this;
  200.     }
  201.     public function getDateDeleted(): ?\DateTimeInterface
  202.     {
  203.         return $this->dateDeleted;
  204.     }
  205.     public function setDateDeleted(?\DateTimeInterface $dateDeleted): SocialNetwork
  206.     {
  207.         $this->dateDeleted $dateDeleted;
  208.         return $this;
  209.     }
  210.     public function getCustomBitly(): ?CustomBitly
  211.     {
  212.         return $this->customBitly;
  213.     }
  214.     public function setCustomBitly(?CustomBitly $customBitly): self
  215.     {
  216.         $this->customBitly $customBitly;
  217.         return $this;
  218.     }
  219.     public function isOnboardingContent(): bool
  220.     {
  221.         return $this->onboardingContent;
  222.     }
  223. }