src/Entity/PinpointCampaign.php line 101

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiProperty;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  8. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  9. use App\Controller\PinpointCampaignConfirmation;
  10. use App\Controller\PinpointCampaignController;
  11. use App\Controller\PinpointCampaignLandingPageController;
  12. use App\Controller\PinpointCampaignLoginController;
  13. use App\Controller\PinpointCampaignSubmission;
  14. use App\Controller\PinpointCampaignSurveyFormSubmissionController;
  15. use App\Controller\SurveyCampaignController;
  16. use App\Controller\SurveyCampaignFormController;
  17. use App\Controller\UnattendedSurveyFormQuestionController;
  18. use App\Validator\PinpointCampaignTestEmail;
  19. use DateTime;
  20. use DateTimeZone;
  21. use Doctrine\Common\Collections\ArrayCollection;
  22. use Doctrine\Common\Collections\Collection;
  23. use Doctrine\ORM\Mapping as ORM;
  24. use Gedmo\Timestampable\Traits\TimestampableEntity;
  25. use Symfony\Component\Serializer\Annotation\Groups;
  26. use Symfony\Component\Validator\Constraints as Assert;
  27. /**
  28.  * @ORM\Entity(repositoryClass="App\Repository\PinpointCampaignRepository")
  29.  * @ORM\HasLifecycleCallbacks()
  30.  * @PinpointCampaignTestEmail()
  31.  */
  32. #[ApiResource(
  33.     normalizationContext: ['groups' => ['pinpointCampaign:item''pinpointCampaign:list']],
  34.     denormalizationContext: ['allow_extra_attributes' => true'groups' => ['pinpointCampaign:write']],
  35.     collectionOperations: [
  36.         'get' => ['normalization_context' => ['groups' => ['pinpointCampaign:list']]],
  37.         'post' => ['security' => "is_granted('ROLE_ADMIN') or object.owner == user"],
  38.         'pinpointcampaign_confirmation' => [
  39.             'method' => 'POST',
  40.             'status' => 204,
  41.             'path' => '/pinpoint_campaigns/confirmation',
  42.             'controller' => PinpointCampaignConfirmation::class,
  43.             'normalizationContext' => ['groups' => ['pinpointCampaign:item']],
  44.         ],
  45.         'pinpointcampaign_submit_survey' => [
  46.             'method' => 'POST',
  47.             'path' => '/survey-campaign/{id}/{userId}/campaign',
  48.             'controller' => PinpointCampaignSubmission::class,
  49.             'defaults' => ['_api_receive' => false],
  50.         ],
  51.         'pinpointcampaign_submit_survey_form' => [
  52.             'method' => 'POST',
  53.             'path' => '/survey-campaign/{id}/{userId}/form',
  54.             'controller' => PinpointCampaignSurveyFormSubmissionController::class,
  55.             'defaults' => ['_api_receive' => false],
  56.         ],
  57.     ],
  58.     itemOperations: [
  59.         'get' => ['normalization_context' => ['groups' => ['pinpointCampaign:item']]],
  60.         'put' => ['security' => "is_granted('ROLE_ADMIN') or object.owner == user"],
  61.         'delete' => ['security' => "is_granted('ROLE_ADMIN') or object.owner == user"],
  62.         'confirmation_pinpointcampaign' => [
  63.             'method' => 'POST',
  64.             'path' => '/pinpoint_campaigns/{id}/confirmation',
  65.             'controller' => PinpointCampaignController::class,
  66.             'normalization_context' => ['groups' => ['pinpointCampaign:item']],
  67.         ],
  68.         'survey_pinpointcampaign' => [
  69.             'method' => 'GET',
  70.             'path' => '/survey-campaign/{id}/{userId}/campaign',
  71.             'controller' => SurveyCampaignController::class,
  72.         ],
  73.         'survey_form_pinpointcampaign' => [
  74.             'method' => 'GET',
  75.             'path' => '/survey-campaign/{id}/{userId}/form',
  76.             'controller' => SurveyCampaignFormController::class,
  77.         ],
  78.         'unattended_survey_form_question' => [
  79.             'method' => 'GET',
  80.             'path' => '/survey-campaign/{id}/{userId}/unattended',
  81.             'controller' => UnattendedSurveyFormQuestionController::class,
  82.         ],
  83.         'pinpointcampaign_assessment_landing' => [
  84.             'method' => 'GET',
  85.             'path' => '/survey-campaign/{id}/landing',
  86.             'controller' => PinpointCampaignLandingPageController::class,
  87.         ],
  88.         'pinpointcampaign_assessment_login' => [
  89.             'method' => 'POST',
  90.             'path' => '/survey-campaign/{id}/login',
  91.             'controller' => PinpointCampaignLoginController::class,
  92.         ],
  93.     ],
  94. )]
  95. #[ApiFilter(SearchFilter::class, properties: ['id''campaignName' => SearchFilter::STRATEGY_PARTIAL'surveyCompany' => SearchFilter::STRATEGY_EXACT'campaignType' => SearchFilter::STRATEGY_EXACT])]
  96. #[ApiFilter(PropertyFilter::class)]
  97. #[ApiFilter(OrderFilter::class, properties: ['id''campaignName''email.label''campaignId''deploymentId''isLanding''channelType''campaignType''createdAt'], arguments: ['orderParameterName' => 'order'])]
  98. class PinpointCampaign
  99. {
  100.     use TimestampableEntity;
  101.     /**
  102.      * @ORM\Id()
  103.      * @ORM\GeneratedValue()
  104.      * @ORM\Column(type="integer")
  105.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  106.      */
  107.     #[ApiProperty(identifiertrue)]
  108.     private $id;
  109.     /**
  110.      * @var string
  111.      *
  112.      * @ORM\Column(type="string",nullable=true, length=50)
  113.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  114.      */
  115.     private ?string $campaignId null;
  116.     /**
  117.      * @var string
  118.      *
  119.      * @ORM\Column(type="string", length=50)
  120.      * @Groups({"pinpointCampaign:item"})
  121.      */
  122.     private $applicationId;
  123.     /**
  124.      * @var string
  125.      *
  126.      * @ORM\Column(type="string", nullable=true,length=50)
  127.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  128.      */
  129.     private $segmentId;
  130.     /**
  131.      * @var string
  132.      *
  133.      * @ORM\Column(type="string", length=100)
  134.      * @Assert\NotBlank()
  135.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  136.      */
  137.     private $campaignName;
  138.     /**
  139.      * @var string
  140.      *
  141.      * @ORM\Column(type="string", length=1000)
  142.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  143.      */
  144.     private $campaignDescription;
  145.     /**
  146.      * @var string
  147.      *
  148.      * @ORM\Column(type="string", length=50)
  149.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  150.      */
  151.     private $scheduleFrequency;
  152.     /**
  153.      * @var string
  154.      *
  155.      * @ORM\Column(type="string", length=50)
  156.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  157.      */
  158.     private $scheduleStarttype;
  159.     /**
  160.      * @var DateTime
  161.      *
  162.      * @ORM\Column(type="datetime", nullable=false)
  163.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  164.      */
  165.     private $scheduleStarttime;
  166.     /**
  167.      * @var DateTime
  168.      *
  169.      * @ORM\Column(type="datetime", nullable=true)
  170.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  171.      */
  172.     // #[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
  173.     public ?\DateTime $scheduleEndtime null;
  174.     /**
  175.      * @var string
  176.      *
  177.      * @ORM\Column(type="string", length=45)
  178.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  179.      */
  180.     private $scheduleTimezone;
  181.     /**
  182.      * @var string
  183.      *
  184.      * @ORM\Column(type="string", length=50)
  185.      * @Assert\NotBlank()
  186.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  187.      */
  188.     private $channelType 'EMAIL';
  189.     /**
  190.      * @var string
  191.      *
  192.      * @ORM\Column(type="string", length=50)
  193.      * @Assert\NotBlank()
  194.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  195.      */
  196.     private $formType;
  197.     /**
  198.      * @var string
  199.      *
  200.      * @ORM\Column(type="string", length=50, nullable=false, columnDefinition="enum('Company', 'Strategic Partner')", options={"default": "Company"})
  201.      * @Assert\NotBlank()
  202.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  203.      */
  204.     private $campaignType 'Company';
  205.     /**
  206.      * @var int
  207.      *
  208.      * @ORM\Column(type="integer", length=5)
  209.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  210.      */
  211.     #[ApiProperty(iri'http://schema.org/Integer')]
  212.     private $deploymentId;
  213.     /**
  214.      * @ORM\Column(type="boolean")
  215.      * @Assert\Type("bool")
  216.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  217.      */
  218.     #[ApiProperty(iri'https://schema.org/Boolean')]
  219.     private $isLanding;
  220.     #[Groups(['pinpointCampaign:item'"pinpointCampaign:list",])]
  221.     public ?string $landingPage null;
  222.     /**
  223.      * @ORM\Column(type="boolean")
  224.      * @Assert\Type("bool")
  225.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  226.      */
  227.     #[ApiProperty(iri'https://schema.org/Boolean')]
  228.     private $isRetargetUsers;
  229.     /**
  230.      * @var string
  231.      *
  232.      * @Assert\NotBlank()
  233.      * @ORM\Column(type="string", length=50, columnDefinition="enum('None','Not Started', 'Not Submitted', 'Everyone')", options={"default": "None"})
  234.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  235.      */
  236.     private $retargetType 'None';
  237.     /**
  238.      * @ORM\Column(type="boolean")
  239.      * @Assert\Type(type="bool")
  240.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  241.      */
  242.     #[ApiProperty(iri'https://schema.org/Boolean')]
  243.     private $isPositionSelection;
  244.     /**
  245.      * @ORM\Column(type="boolean")
  246.      * @Assert\Type(type="bool")
  247.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  248.      */
  249.     #[ApiProperty(iri'https://schema.org/Boolean')]
  250.     private $isDepartmentSelection;
  251.     /**
  252.      * @ORM\Column(type="boolean")
  253.      * @Assert\Type(type="boolean")
  254.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  255.      */
  256.     #[ApiProperty(iri'https://schema.org/Boolean')]
  257.     private $isBirthDateSelection;
  258.     /**
  259.      * @ORM\Column(type="boolean")
  260.      * @Assert\Type(type="boolean")
  261.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  262.      */
  263.     #[ApiProperty(iri'https://schema.org/Boolean')]
  264.     private $isEthnicitySelection;
  265.     /**
  266.      * @ORM\Column(type="boolean")
  267.      * @Assert\Type(type="boolean")
  268.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  269.      */
  270.     #[ApiProperty(iri'https://schema.org/Boolean')]
  271.     private $isRaceSelection;
  272.     /**
  273.      * @ORM\Column(type="boolean")
  274.      * @Assert\Type(type="boolean")
  275.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  276.      */
  277.     #[ApiProperty(iri'https://schema.org/Boolean')]
  278.     private $isGenderSelection;
  279.     /**
  280.      * @ORM\Column(type="boolean")
  281.      * @Assert\Type(type="boolean")
  282.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  283.      */
  284.     #[ApiProperty(iri'https://schema.org/Boolean')]
  285.     private $isLanguageSelection;
  286.     /**
  287.      * @ORM\Column(type="boolean")
  288.      * @Assert\Type(type="boolean")
  289.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  290.      */
  291.     #[ApiProperty(iri'https://schema.org/Boolean')]
  292.     private $mailAssociatedUser;
  293.     /**
  294.      * @ORM\Column(type="integer")
  295.      * @Assert\NotBlank()
  296.      * @Assert\Type(type="integer")
  297.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  298.      */
  299.     #[ApiProperty(iri'http://schema.org/Integer')]
  300.     private $quesCountFirst;
  301.     /**
  302.      * @ORM\Column(type="integer")
  303.      * @Assert\NotBlank()
  304.      * @Assert\Type(type="integer")
  305.      * @Groups({"pinpointCampaign:item","pinpointCampaign:write"})
  306.      */
  307.     #[ApiProperty(iri'http://schema.org/Integer')]
  308.     private $quesCountAlternate;
  309.     /**
  310.      * @var string
  311.      *
  312.      * @ORM\Column(type="string", length=500)
  313.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  314.      */
  315.     private $emailTitle;
  316.     /**
  317.      * @var string
  318.      *
  319.      * @ORM\Column(type="string",nullable=true, length=50)
  320.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  321.      */
  322.     private $emailFromName;
  323.     /**
  324.      * @var string
  325.      *
  326.      * @ORM\Column(type="string", length=200)
  327.      * @Assert\NotBlank()
  328.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  329.      */
  330.     private $emailFrom;
  331.     /**
  332.      * @var string
  333.      *
  334.      * @ORM\Column(type="string", length=500, nullable=true)
  335.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  336.      */
  337.     private $emailCC;
  338.     /**
  339.      * @ORM\ManyToOne(targetEntity="App\Entity\Email", inversedBy="pinpointCampaigns")
  340.      * @ORM\JoinColumn(nullable=true)
  341.      * @ORM\OrderBy({"id" = "DESC"})
  342.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  343.      */
  344.     private Email $email;
  345.     /**
  346.      * @var string
  347.      *
  348.      * @ORM\Column(type="text")
  349.      * @Assert\NotBlank()
  350.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  351.      */
  352.     private $emailBody;
  353.     /**
  354.      * @var string
  355.      *
  356.      * @ORM\Column(type="text")
  357.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  358.      */
  359.     private $emailHtmlbody;
  360.     /**
  361.      * @var string
  362.      *
  363.      * @ORM\Column(type="string", length=500)
  364.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  365.      */
  366.     private $smsBody;
  367.     /**
  368.      * @var string
  369.      *
  370.      * @ORM\Column(type="string", length=60, nullable=true)
  371.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  372.      */
  373.     private $smsMessagetype;
  374.     /**
  375.      * @var string
  376.      *
  377.      * @ORM\Column(type="string", length=60, nullable=true)
  378.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  379.      */
  380.     private $smsSenderid;
  381.     /**
  382.      * @var SurveyCompany
  383.      *
  384.      * @ORM\ManyToOne(targetEntity="App\Entity\SurveyCompany", inversedBy="pinpointCampaigns", cascade={"persist"})
  385.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  386.      */
  387.     private $surveyCompany;
  388.     /**
  389.      * @var Department
  390.      *
  391.      * @ORM\ManyToOne(targetEntity="App\Entity\Department")
  392.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  393.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  394.      */
  395.     private $department;
  396.     /**
  397.      * @var City
  398.      *
  399.      * @ORM\ManyToOne(targetEntity="App\Entity\City")
  400.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  401.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  402.      */
  403.     private $city;
  404.     /**
  405.      * @var ArrayCollection|SurveyContribution[]
  406.      *
  407.      * @ORM\OneToMany(targetEntity="App\Entity\SurveyContribution", cascade={"persist"}, mappedBy="pinpointCampaign")
  408.      */
  409.     private $surveyContributions;
  410.     /**
  411.      * @var PinpointCampaign
  412.      *
  413.      * @ORM\ManyToOne(targetEntity="App\Entity\PinpointCampaign")
  414.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  415.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list","pinpointCampaign:write"})
  416.      */
  417.     private $pinpointCampaign;
  418.     /**
  419.      * @ORM\OneToMany(targetEntity=PinpointCampaignQuestion::class, mappedBy="pinpointCampaign")
  420.      */
  421.     private $pinpointCampaignQuestions;
  422.     /**
  423.      * @ORM\OneToMany(targetEntity=PinpointCampaignUser::class, cascade={"persist"}, mappedBy="pinpointCampaign", orphanRemoval=true)
  424.      */
  425.     private $pinpointCampaignUsers;
  426.     /**
  427.      * @ORM\ManyToOne(targetEntity=MediaImage::class, inversedBy="pinpointCampaigns")
  428.      * @ORM\JoinColumn(name="image_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  429.      * @Groups({"pinpointCampaign:item"})
  430.      */
  431.     private $image;
  432.     /**
  433.      * @ORM\OneToMany(targetEntity=CampaignSchedule::class, mappedBy="pinpointCampaign", orphanRemoval=true, cascade={"persist"})
  434.      */
  435.     private $campaignSchedules;
  436.     public function __construct()
  437.     {
  438.         $this->isLanding false;
  439.         $this->isRetargetUsers false;
  440.         $this->isLanguageSelection false;
  441.         $this->isPositionSelection false;
  442.         $this->isDepartmentSelection false;
  443.         $this->isBirthDateSelection false;
  444.         $this->isEthnicitySelection false;
  445.         $this->isGenderSelection false;
  446.         $this->isRaceSelection false;
  447.         $this->mailAssociatedUser false;
  448.         $this->quesCountFirst 60;
  449.         $this->deploymentId 0;
  450.         $this->quesCountAlternate 12;
  451.         $this->scheduleStarttime = new \DateTime();
  452.         $this->scheduleEndtime null;
  453.         $this->scheduleTimezone 'UTC';
  454.         $this->segmentId 'dynamic_segement';
  455.         $this->applicationId 'e22c6ebe3c9a45f4a51ae42c3c205ef8';
  456.         $this->emailFrom 'customersuccess@kanarys.com';
  457.         $this->emailFromName 'Kanarys';
  458.         $this->emailTitle 'DEI Assessment';
  459.         $this->emailBody 'Hi {{Attributes.Name}}, Please click url: %url%';
  460.         $this->emailHtmlbody "<p>Hi {{Attributes.Name}},</p><p>Please click below url:<br/><a href='%url%'>Click Here</a></p>";
  461.         $this->smsBody 'Hi {{Attributes.Name}}, Please click url: %url%';
  462.         $this->surveyContributions = new ArrayCollection();
  463.         $this->pinpointCampaignUsers = new ArrayCollection();
  464.         $this->pinpointCampaignQuestions = new ArrayCollection();
  465.         $this->campaignSchedules = new ArrayCollection();
  466.     }
  467.     /**
  468.      * @return string
  469.      */
  470.     public function __toString()
  471.     {
  472.         return $this->campaignName;
  473.     }
  474.     /**
  475.      * @return string
  476.      */
  477.     public function getLandingPage(): ?string
  478.     {
  479.         return $this->landingPage = ($this->isLanding) ? $_ENV['APP_PROTOCOL'] . '://' $_ENV['APP_DOMAIN'] . '/survey-campaign/campaign/' $this->id '';
  480.     }
  481.     public function getId(): ?int
  482.     {
  483.         return $this->id;
  484.     }
  485.     public function getCampaignId(): ?string
  486.     {
  487.         return $this->campaignId;
  488.     }
  489.     public function setCampaignId(?string $campaignId): self
  490.     {
  491.         $this->campaignId $campaignId;
  492.         return $this;
  493.     }
  494.     public function getApplicationId(): ?string
  495.     {
  496.         return $this->applicationId;
  497.     }
  498.     public function setApplicationId(string $applicationId): self
  499.     {
  500.         $this->applicationId $applicationId;
  501.         return $this;
  502.     }
  503.     public function getSegmentId(): ?string
  504.     {
  505.         return $this->segmentId;
  506.     }
  507.     public function setSegmentId(?string $segmentId): self
  508.     {
  509.         $this->segmentId $segmentId;
  510.         return $this;
  511.     }
  512.     public function getCampaignName(): ?string
  513.     {
  514.         return $this->campaignName;
  515.     }
  516.     public function setCampaignName(string $campaignName): self
  517.     {
  518.         $this->campaignName $campaignName;
  519.         return $this;
  520.     }
  521.     public function getCampaigDescription(): ?string
  522.     {
  523.         return $this->campaignDescription;
  524.     }
  525.     public function setCampaignDescription(?string $campaignDescription): self
  526.     {
  527.         $this->campaignDescription $campaignDescription;
  528.         return $this;
  529.     }
  530.     public function getScheduleFrequency(): ?string
  531.     {
  532.         return $this->scheduleFrequency;
  533.     }
  534.     public function setScheduleFrequency(?string $scheduleFrequency): self
  535.     {
  536.         $this->scheduleFrequency $scheduleFrequency;
  537.         return $this;
  538.     }
  539.     public function getScheduleStarttype(): ?string
  540.     {
  541.         return $this->scheduleStarttype;
  542.     }
  543.     public function setScheduleStarttype(?string $scheduleStarttype): self
  544.     {
  545.         $this->scheduleStarttype $scheduleStarttype;
  546.         return $this;
  547.     }
  548.     public function getScheduleStarttime(): DateTime
  549.     {
  550.         return $this->scheduleStarttime;
  551.     }
  552.     public function setScheduleStarttime(DateTime $scheduleStarttime): self
  553.     {
  554.         $this->scheduleStarttime $scheduleStarttime->setTimezone(new DateTimeZone('US/Central'));
  555.         return $this;
  556.     }
  557.     public function getScheduleEndtime(): ?DateTime
  558.     {
  559.         return $this->scheduleEndtime;
  560.     }
  561.     public function setScheduleEndtime(?DateTime $scheduleEndtime): self
  562.     {
  563.         $this->scheduleEndtime $scheduleEndtime;
  564.         return $this;
  565.     }
  566.     public function getScheduleTimezone(): ?string
  567.     {
  568.         return $this->scheduleTimezone;
  569.     }
  570.     public function setScheduleTimezone(?string $scheduleTimezone): self
  571.     {
  572.         $this->scheduleTimezone $scheduleTimezone;
  573.         return $this;
  574.     }
  575.     public function getChannelType(): ?string
  576.     {
  577.         return $this->channelType;
  578.     }
  579.     public function setChannelType(string $channelType): self
  580.     {
  581.         $this->channelType $channelType;
  582.         return $this;
  583.     }
  584.     public function getFormType(): ?string
  585.     {
  586.         return $this->formType;
  587.     }
  588.     public function setFormType(string $formType): self
  589.     {
  590.         $this->formType $formType;
  591.         return $this;
  592.     }
  593.     public function getCampaignType(): ?string
  594.     {
  595.         return $this->campaignType;
  596.     }
  597.     public function setCampaignType(string $campaignType): self
  598.     {
  599.         $this->campaignType $campaignType;
  600.         return $this;
  601.     }
  602.     public function getIsLanding(): bool
  603.     {
  604.         return $this->isLanding;
  605.     }
  606.     public function setIsLanding(?bool $isLanding): self
  607.     {
  608.         if (null === $isLanding) {
  609.             $this->isLanding false;
  610.         } else {
  611.             $this->isLanding $isLanding;
  612.         }
  613.         return $this;
  614.     }
  615.     public function getIsRetargetUsers(): bool
  616.     {
  617.         return $this->isRetargetUsers;
  618.     }
  619.     public function getRetargetType(): string
  620.     {
  621.         return $this->retargetType;
  622.     }
  623.     public function setRetargetType(string $retargetType): self
  624.     {
  625.         $this->retargetType $retargetType;
  626.         return $this;
  627.     }
  628.     public function getIsLanguageSelection(): bool
  629.     {
  630.         return $this->isLanguageSelection;
  631.     }
  632.     public function setIsLanguageSelection(?bool $isLanguageSelection): self
  633.     {
  634.         if (null === $isLanguageSelection) {
  635.             $this->isLanguageSelection false;
  636.         } else {
  637.             $this->isLanguageSelection $isLanguageSelection;
  638.         }
  639.         return $this;
  640.     }
  641.     public function setIsPositionSelection(?bool $isPositionSelection): self
  642.     {
  643.         if (null === $isPositionSelection) {
  644.             $this->isPositionSelection false;
  645.         } else {
  646.             $this->isPositionSelection $isPositionSelection;
  647.         }
  648.         return $this;
  649.     }
  650.     public function getIsPositionSelection(): bool
  651.     {
  652.         return $this->isPositionSelection;
  653.     }
  654.     public function setIsDepartmentSelection(?bool $isDepartmentSelection): self
  655.     {
  656.         if (null === $isDepartmentSelection) {
  657.             $this->isDepartmentSelection false;
  658.         } else {
  659.             $this->isDepartmentSelection $isDepartmentSelection;
  660.         }
  661.         return $this;
  662.     }
  663.     public function getIsDepartmentSelection(): bool
  664.     {
  665.         return $this->isDepartmentSelection;
  666.     }
  667.     public function setIsBirthDateSelection(?bool $isBirthDateSelection): self
  668.     {
  669.         if (null === $isBirthDateSelection) {
  670.             $this->isBirthDateSelection false;
  671.         } else {
  672.             $this->isBirthDateSelection $isBirthDateSelection;
  673.         }
  674.         return $this;
  675.     }
  676.     public function getIsBirthDateSelection(): bool
  677.     {
  678.         return $this->isBirthDateSelection;
  679.     }
  680.     public function setIsEthnicitySelection(?bool $isEthnicitySelection): self
  681.     {
  682.         if (null === $isEthnicitySelection) {
  683.             $this->isEthnicitySelection false;
  684.         } else {
  685.             $this->isEthnicitySelection $isEthnicitySelection;
  686.         }
  687.         return $this;
  688.     }
  689.     public function getIsEthnicitySelection(): bool
  690.     {
  691.         return $this->isEthnicitySelection;
  692.     }
  693.     public function getIsGenderSelection(): bool
  694.     {
  695.         return $this->isGenderSelection;
  696.     }
  697.     public function setIsGenderSelection(?bool $isGenderSelection): self
  698.     {
  699.         if (null === $isGenderSelection) {
  700.             $this->isGenderSelection false;
  701.         } else {
  702.             $this->isGenderSelection $isGenderSelection;
  703.         }
  704.         return $this;
  705.     }
  706.     public function getIsRaceSelection(): bool
  707.     {
  708.         return $this->isRaceSelection;
  709.     }
  710.     public function setIsRaceSelection(?bool $isRaceSelection): self
  711.     {
  712.         if (null === $isRaceSelection) {
  713.             $this->isRaceSelection false;
  714.         } else {
  715.             $this->isRaceSelection $isRaceSelection;
  716.         }
  717.         return $this;
  718.     }
  719.     public function setMailAssociatedUser(bool $mailAssociatedUser): void
  720.     {
  721.         if (null === $mailAssociatedUser) {
  722.             $this->mailAssociatedUser false;
  723.         } else {
  724.             $this->mailAssociatedUser $mailAssociatedUser;
  725.         }
  726.     }
  727.     public function getMailAssociatedUser(): bool
  728.     {
  729.         return $this->mailAssociatedUser;
  730.     }
  731.     public function setIsRetargetUsers(?bool $isRetargetUsers): self
  732.     {
  733.         if (null === $isRetargetUsers) {
  734.             $this->isRetargetUsers false;
  735.         } else {
  736.             $this->isRetargetUsers $isRetargetUsers;
  737.         }
  738.         return $this;
  739.     }
  740.     public function getQuesCountFirst(): int
  741.     {
  742.         return $this->quesCountFirst;
  743.     }
  744.     public function setQuesCountFirst(int $quesCountFirst): self
  745.     {
  746.         $this->quesCountFirst $quesCountFirst;
  747.         return $this;
  748.     }
  749.     public function getQuesCountAlternate(): int
  750.     {
  751.         return $this->quesCountAlternate;
  752.     }
  753.     public function setQuesCountAlternate(int $quesCountAlternate): self
  754.     {
  755.         $this->quesCountAlternate $quesCountAlternate;
  756.         return $this;
  757.     }
  758.     public function getDeploymentId(): ?int
  759.     {
  760.         return $this->deploymentId;
  761.     }
  762.     public function setDeploymentId(?string $deploymentId): self
  763.     {
  764.         $this->deploymentId $deploymentId;
  765.         return $this;
  766.     }
  767.     public function getEmailTitle(): ?string
  768.     {
  769.         return $this->emailTitle;
  770.     }
  771.     public function setEmailTitle(?string $emailTitle): self
  772.     {
  773.         $this->emailTitle $emailTitle;
  774.         return $this;
  775.     }
  776.     public function getEmailFromName(): ?string
  777.     {
  778.         return $this->emailFromName;
  779.     }
  780.     public function setEmailFromName(?string $emailFromName): self
  781.     {
  782.         $this->emailFromName $emailFromName;
  783.         return $this;
  784.     }
  785.     public function getEmailFrom(): ?string
  786.     {
  787.         return $this->emailFrom;
  788.     }
  789.     public function setEmailFrom(?string $emailFrom): self
  790.     {
  791.         $this->emailFrom $emailFrom;
  792.         return $this;
  793.     }
  794.     public function getEmailCC(): ?string
  795.     {
  796.         return $this->emailCC;
  797.     }
  798.     public function setEmailCC(?string $emailCC): self
  799.     {
  800.         $this->emailCC $emailCC;
  801.         return $this;
  802.     }
  803.     public function getEmail(): ?Email
  804.     {
  805.         return $this->email;
  806.     }
  807.     public function setEmail(?Email $email): self
  808.     {
  809.         $this->email $email;
  810.         return $this;
  811.     }
  812.     public function getEmailBody(): ?string
  813.     {
  814.         return $this->emailBody;
  815.     }
  816.     public function setEmailBody(?string $emailBody): self
  817.     {
  818.         $this->emailBody $emailBody;
  819.         return $this;
  820.     }
  821.     public function getEmailHtmlbody(): ?string
  822.     {
  823.         return $this->emailHtmlbody;
  824.     }
  825.     public function setEmailHtmlbody(?string $emailHtmlbody): self
  826.     {
  827.         $this->emailHtmlbody $emailHtmlbody;
  828.         return $this;
  829.     }
  830.     public function getSmsBody(): ?string
  831.     {
  832.         return $this->smsBody;
  833.     }
  834.     public function setSmsBody(?string $smsBody): self
  835.     {
  836.         $this->smsBody $smsBody;
  837.         return $this;
  838.     }
  839.     public function getSmsMessagetype(): ?string
  840.     {
  841.         return $this->smsMessagetype;
  842.     }
  843.     public function setSmsMessagetype(?string $smsMessagetype): self
  844.     {
  845.         $this->smsMessagetype $smsMessagetype;
  846.         return $this;
  847.     }
  848.     public function getSmsSenderid(): ?string
  849.     {
  850.         return $this->smsSenderid;
  851.     }
  852.     public function setSmsSenderid(?string $smsSenderid): self
  853.     {
  854.         $this->smsSenderid $smsSenderid;
  855.         return $this;
  856.     }
  857.     public function getSurveyCompany(): ?SurveyCompany
  858.     {
  859.         return $this->surveyCompany;
  860.     }
  861.     public function setSurveyCompany(?SurveyCompany $surveyCompany): self
  862.     {
  863.         $this->surveyCompany $surveyCompany;
  864.         return $this;
  865.     }
  866.     public function getDepartment(): ?Department
  867.     {
  868.         return $this->department;
  869.     }
  870.     public function setDepartment(?Department $department): self
  871.     {
  872.         $this->department $department;
  873.         return $this;
  874.     }
  875.     public function getCity(): ?City
  876.     {
  877.         return $this->city;
  878.     }
  879.     public function setCity(?City $city): self
  880.     {
  881.         $this->city $city;
  882.         return $this;
  883.     }
  884.     /**
  885.      * @return Collection|SurveyContribution[]
  886.      */
  887.     public function getSurveyContributions(): Collection
  888.     {
  889.         return $this->surveyContributions;
  890.     }
  891.     public function addSurveyContribution(SurveyContribution $surveyContribution): self
  892.     {
  893.         if (!$this->surveyContributions->contains($surveyContribution)) {
  894.             $this->surveyContributions[] = $surveyContribution;
  895.             $surveyContribution->setUser($surveyContribution->getUser());
  896.         }
  897.         return $this;
  898.     }
  899.     public function removeSurveyContribution(SurveyContribution $surveyContribution): self
  900.     {
  901.         if ($this->surveyContributions->contains($surveyContribution)) {
  902.             $this->surveyContributions->removeElement($surveyContribution);
  903.             // set the owning side to null (unless already changed)
  904.             if ($surveyContribution->getUser() === $this) {
  905.                 $surveyContribution->setUser(null);
  906.             }
  907.         }
  908.         return $this;
  909.     }
  910.     public function getPinpointCampaign(): ?PinpointCampaign
  911.     {
  912.         return $this->pinpointCampaign;
  913.     }
  914.     public function setPinpointCampaign(?PinpointCampaign $pinpointCampaign): self
  915.     {
  916.         $this->pinpointCampaign $pinpointCampaign;
  917.         return $this;
  918.     }
  919.     #[Groups('pinpointCampaign:item')]
  920.     public function getTotalActiveUser(): int
  921.     {
  922.         return $this->pinpointCampaignUsers->filter(function ($item) {
  923.             return true == $item->getUser()->getEnable();
  924.         })->count();
  925.     }
  926.     #[Groups('pinpointCampaign:item')]
  927.     public function getTotalInActiveUser(): int
  928.     {
  929.         return $this->pinpointCampaignUsers->filter(function ($item) {
  930.             return true == $item->getUser()->getEnable();
  931.         })->count();
  932.     }
  933.     #[Groups('pinpointCampaign:item')]
  934.     public function getTotalSurveyQuestion(): int
  935.     {
  936.         return $this->surveyCompany->getSurveyCompanyQuestions()->count();
  937.     }
  938.     /**
  939.      * @return Collection<int, PinpointCampaignQuestion>
  940.      */
  941.     public function getPinpointCampaignQuestions(): Collection
  942.     {
  943.         return $this->pinpointCampaignQuestions;
  944.     }
  945.     public function addPinpointCampaignQuestion(PinpointCampaignQuestion $pinpointCampaignQuestion): self
  946.     {
  947.         if (!$this->pinpointCampaignQuestions->contains($pinpointCampaignQuestion)) {
  948.             $this->pinpointCampaignQuestions[] = $pinpointCampaignQuestion;
  949.             $pinpointCampaignQuestion->setPinpointCampaign($this);
  950.         }
  951.         return $this;
  952.     }
  953.     public function removePinpointCampaignQuestion(PinpointCampaignQuestion $pinpointCampaignQuestion): self
  954.     {
  955.         if ($this->pinpointCampaignQuestions->removeElement($pinpointCampaignQuestion)) {
  956.             // set the owning side to null (unless already changed)
  957.             if ($pinpointCampaignQuestion->getPinpointCampaign() === $this) {
  958.                 $pinpointCampaignQuestion->setPinpointCampaign(null);
  959.             }
  960.         }
  961.         return $this;
  962.     }
  963.     /**
  964.      * @return Collection<int, PinpointCampaignUser>
  965.      */
  966.     public function getPinpointCampaignUsers(): Collection
  967.     {
  968.         return $this->pinpointCampaignUsers;
  969.     }
  970.     public function addPinpointCampaignUser(PinpointCampaignUser $pinpointCampaignUser): self
  971.     {
  972.         if (!$this->pinpointCampaignUsers->contains($pinpointCampaignUser)) {
  973.             $this->pinpointCampaignUsers[] = $pinpointCampaignUser;
  974.             $pinpointCampaignUser->setPinpointCampaign($this);
  975.         }
  976.         return $this;
  977.     }
  978.     public function removePinpointCampaignUser(PinpointCampaignUser $pinpointCampaignUser): self
  979.     {
  980.         if ($this->pinpointCampaignUsers->removeElement($pinpointCampaignUser)) {
  981.             // set the owning side to null (unless already changed)
  982.             if ($pinpointCampaignUser->getPinpointCampaign() === $this) {
  983.                 $pinpointCampaignUser->setPinpointCampaign(null);
  984.             }
  985.         }
  986.         return $this;
  987.     }
  988.     /**
  989.      * @return Collection<int, CampaignSchedule>
  990.      */
  991.     public function getCampaignSchedules(): Collection
  992.     {
  993.         return $this->campaignSchedules;
  994.     }
  995.     public function addCampaignSchedule(CampaignSchedule $campaignSchedule): self
  996.     {
  997.         if (!$this->campaignSchedules->contains($campaignSchedule)) {
  998.             $this->campaignSchedules[] = $campaignSchedule;
  999.             $campaignSchedule->setPinpointCampaign($this);
  1000.         }
  1001.         return $this;
  1002.     }
  1003.     public function removeCampaignSchedule(CampaignSchedule $campaignSchedule): self
  1004.     {
  1005.         if ($this->campaignSchedules->removeElement($campaignSchedule)) {
  1006.             // set the owning side to null (unless already changed)
  1007.             if ($campaignSchedule->getPinpointCampaign() === $this) {
  1008.                 $campaignSchedule->setPinpointCampaign(null);
  1009.             }
  1010.         }
  1011.         return $this;
  1012.     }
  1013.     /**
  1014.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list"})
  1015.      */
  1016.     public function getCreatedAt(): ?\DateTimeInterface
  1017.     {
  1018.         return $this->createdAt;
  1019.     }
  1020.     /**
  1021.      * @Groups({"pinpointCampaign:item","pinpointCampaign:list"})
  1022.      * Returns string.
  1023.      */
  1024.     public function getIsExpired(): ?string
  1025.     {
  1026.         $now  = new DateTime('now');
  1027.         $end $this->scheduleEndtime;
  1028.         if (null === $this->scheduleEndtime) {
  1029.             return 'Active';
  1030.         } else {
  1031.             return ($end $now ) ? 'Expired' 'Active';
  1032.         }
  1033.     }
  1034.     public function getImage(): ?MediaImage
  1035.     {
  1036.         return $this->image;
  1037.     }
  1038.     public function setImage(?MediaImage $image): self
  1039.     {
  1040.         $this->image $image;
  1041.         return $this;
  1042.     }
  1043. }