src/Bidcoz/Bundle/CoreBundle/Entity/Campaign.php line 56

Open in your IDE?
  1. <?php
  2. namespace Bidcoz\Bundle\CoreBundle\Entity;
  3. use Bidcoz\Bundle\CoreBundle\Constants;
  4. use Bidcoz\Bundle\CoreBundle\Entity\Auction\Auction;
  5. use Bidcoz\Bundle\CoreBundle\Entity\Auction\BidNumber;
  6. use Bidcoz\Bundle\CoreBundle\Entity\Auction\FundANeed;
  7. use Bidcoz\Bundle\CoreBundle\Entity\Auction\Shop;
  8. use Bidcoz\Bundle\CoreBundle\Entity\Contact\CampaignDetail;
  9. use Bidcoz\Bundle\CoreBundle\Entity\Donation\CashDonation;
  10. use Bidcoz\Bundle\CoreBundle\Entity\Donation\CryptoWallet;
  11. use Bidcoz\Bundle\CoreBundle\Entity\Donation\DonationLevel;
  12. use Bidcoz\Bundle\CoreBundle\Entity\Donation\MembershipLevel;
  13. use Bidcoz\Bundle\CoreBundle\Entity\Procurement\Item;
  14. use Bidcoz\Bundle\CoreBundle\Entity\Purchase\Donation\PaddleRaiseDonationPurchase;
  15. use Bidcoz\Bundle\CoreBundle\Entity\Purchase\Purchase;
  16. use Bidcoz\Bundle\CoreBundle\Entity\Raffle\RaffleType;
  17. use Bidcoz\Bundle\CoreBundle\Entity\Registration\Registration;
  18. use Bidcoz\Bundle\CoreBundle\Entity\Registration\RegistrationType;
  19. use Bidcoz\Bundle\CoreBundle\Entity\Sponsorship\Sponsorship;
  20. use Bidcoz\Bundle\CoreBundle\Entity\Sponsorship\SponsorshipLevel;
  21. use Bidcoz\Bundle\CoreBundle\Entity\Ticket\SeatingChartImage;
  22. use Bidcoz\Bundle\CoreBundle\Entity\Ticket\Ticket;
  23. use Bidcoz\Bundle\CoreBundle\Entity\Ticket\TicketGroup;
  24. use Bidcoz\Bundle\CoreBundle\Entity\Ticket\TicketType;
  25. use Bidcoz\Bundle\CoreBundle\Entity\Transaction\Transaction;
  26. use Bidcoz\Bundle\CoreBundle\ObjectChange\ObjectChangeTrackable;
  27. use DateTime;
  28. use Doctrine\Common\Collections\ArrayCollection;
  29. use Doctrine\Common\Collections\Collection;
  30. use Doctrine\Inflector\InflectorFactory;
  31. use Doctrine\ORM\Event\PreFlushEventArgs;
  32. use Doctrine\ORM\Mapping as ORM;
  33. use JMS\Serializer\Annotation as Serialize;
  34. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  35. use Symfony\Component\Validator\Constraints as Assert;
  36. use Symfony\Component\Validator\Context\ExecutionContextInterface;
  37. /**
  38.  * @ORM\Entity(repositoryClass="CampaignRepository")
  39.  * @ORM\Table(
  40.  *      name="campaigns",
  41.  *      uniqueConstraints={
  42.  *          @ORM\UniqueConstraint(name="campaign_slug_org_id_uk",columns={"slug", "organization_id"})
  43.  *      },
  44.  * )
  45.  * @ORM\HasLifecycleCallbacks()
  46.  * @Serialize\ExclusionPolicy("all")
  47.  * @UniqueEntity(
  48.  *     fields={"slug", "organization"},
  49.  *     errorPath="slug",
  50.  *     message="This Flight Web Address is already in use. Please choose a different one."
  51.  * )
  52.  */
  53. class Campaign implements ThemeableObjectChangeTrackable
  54. {
  55.     public const FEE_USER         'user';
  56.     public const FEE_ORGANIZATION 'organization';
  57.     public const FEE_CHOICE       'choice';
  58.     public const TICKET_TYPE_GENERAL_ADMISSION 'general';
  59.     public const TICKET_TYPE_ASSIGNED          'assigned';
  60.     // const TICKET_TYPE_RESERVED          = 'reserved';
  61.     public const DEFAULT_TIMEZONE 'America/Chicago';
  62.     /**
  63.      * List of all available components
  64.      * keys names must be an underscore version
  65.      * of a Campaign's component property name without 'has_' prefix
  66.      * e.g. hasItemDonations --> item_donations.
  67.      *
  68.      * @var array
  69.      */
  70.     private static $components = [
  71.         'auction'        => 'Auction',
  72.         'sponsorship'    => 'Sponsor Ads',
  73.         'cash_donations' => 'Donation Booster',
  74.         'fund_drive'     => 'Appeal',
  75.         'procurement'    => 'Procurement',
  76.         'tickets'        => 'Tickets',
  77.         'registrations'  => 'Registrations',
  78.         'paddle_raise'   => 'Paddle Raise',
  79.         //TODO: Keep legacy name 'volunteers'.
  80.         //Needs proper refactoring. Used for Campaign::hasVolunteers in code and templates.
  81.         'volunteers'     => 'Crewup',
  82.     ];
  83.     public static function getComponentsList()
  84.     {
  85.         return self::$components;
  86.     }
  87.     /**
  88.      * @ORM\Id
  89.      * @ORM\Column(name="id", type="integer")
  90.      * @ORM\GeneratedValue(strategy="AUTO")
  91.      * @Serialize\Expose
  92.      * @Serialize\Groups({"Default", "API"})
  93.      */
  94.     protected ?int $id null;
  95.     /**
  96.      * @ORM\Column(name="name", type="text")
  97.      * @Assert\NotBlank
  98.      * @Serialize\Expose
  99.      * @Serialize\Groups({"Default", "API"})
  100.      */
  101.     protected $name;
  102.     /**
  103.      * @ORM\Column(name="slug", type="string", length=50);
  104.      * @Assert\NotBlank(message="Flight Web Address is required")
  105.      * @Assert\Length(max=50, maxMessage="Flight Web Address must be 50 characters or less")
  106.      * @Assert\Regex(pattern="/^[0-9a-z-]+$/", message="Flight Web Address can only contain lower-case letters, numbers and dashes")
  107.      * @Serialize\Expose
  108.      * @Serialize\Groups({"Default", "API"})
  109.      */
  110.     protected $slug;
  111.     /**
  112.      * @ORM\ManyToOne(targetEntity="Organization", inversedBy="campaigns")
  113.      * @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="CASCADE")
  114.      * @Serialize\Expose
  115.      * @Serialize\Groups({"API"})
  116.      */
  117.     protected ?Organization $organization null;
  118.     /**
  119.      * @ORM\Column(name="active", type="boolean");
  120.      */
  121.     protected $active true;
  122.     /**
  123.      * @ORM\Column(name="description", type="text", nullable=true)
  124.      */
  125.     protected $description;
  126.     /**
  127.      * Short narrative line shown below the title in the Story First theme hero.
  128.      *
  129.      * @ORM\Column(name="hero_description", type="text", nullable=true)
  130.      */
  131.     protected $heroDescription;
  132.     /**
  133.      * @ORM\Column(name="service_fee_type", type="text", length=20);
  134.      */
  135.     protected $feeType self::FEE_USER;
  136.     /**
  137.      * @ORM\Column(name="transaction_fee_passthrough", type="boolean", options={"default" : 0})
  138.      * @Serialize\Expose
  139.      */
  140.     protected $transactionFeePassthrough false;
  141.     /**
  142.      * @ORM\Column(name="collect_cc_info", type="boolean", options={"default" : 1})
  143.      * @Serialize\Expose
  144.      */
  145.     protected $collectCcInfo true;
  146.     /**
  147.      * @ORM\Column(name="details_title", type="text", nullable=true);
  148.      */
  149.     protected $detailsTitle;
  150.     /**
  151.      * @ORM\Column(name="details_body", type="text", nullable=true);
  152.      */
  153.     protected $detailsBody;
  154.     /**
  155.      * @ORM\Column(name="homepage_content", type="text", nullable=true);
  156.      */
  157.     protected $homepageContent;
  158.     /**
  159.      * @ORM\Embedded(class="VideoEmbed", columnPrefix="video_")
  160.      */
  161.     protected $video;
  162.     /**
  163.      * @ORM\Column(name="has_auction", type="boolean")
  164.      * @Serialize\Expose
  165.      */
  166.     protected $hasAuction false;
  167.     /**
  168.      * @ORM\Column(name="has_shop", type="boolean")
  169.      * @Serialize\Expose
  170.      */
  171.     protected $hasShop false;
  172.     /**
  173.      * @ORM\Column(name="has_fund_a_need", type="boolean")
  174.      * @Serialize\Expose
  175.      */
  176.     protected $hasFundANeed false;
  177.     /**
  178.      * @ORM\OneToOne(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Auction\Auction", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  179.      */
  180.     protected ?Auction $auction null;
  181.     /**
  182.      * @ORM\OneToOne(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Auction\Shop", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  183.      */
  184.     protected ?Shop $shop null;
  185.     /**
  186.      * @ORM\OneToOne(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Auction\FundANeed", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  187.      */
  188.     protected ?FundANeed $fundANeed null;
  189.     /**
  190.      * @ORM\Column(name="has_sponsorship", type="boolean")
  191.      * @Assert\NotNull
  192.      */
  193.     protected $hasSponsorship false;
  194.     /**
  195.      * @ORM\Column(name="sponsorship_signup", type="boolean")
  196.      * @Assert\NotNull
  197.      */
  198.     protected $sponsorshipSignup true;
  199.     /**
  200.      * @var Collection|Sponsorship[]|null
  201.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Sponsorship\Sponsorship", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  202.      */
  203.     protected ?Collection $sponsorships null;
  204.     /**
  205.      * @var Collection|SponsorshipLevel[]|null
  206.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Sponsorship\SponsorshipLevel", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  207.      */
  208.     protected ?Collection $sponsorshipLevels null;
  209.     /**
  210.      * @ORM\Column(name="has_tickets", type="boolean")
  211.      * @Assert\NotNull
  212.      */
  213.     protected $hasTickets false;
  214.     /**
  215.      * @ORM\Column(name="self_check_in_date", type="datetime", nullable=true)
  216.      */
  217.     protected $selfCheckInDate;
  218.     /**
  219.      * @ORM\Column(name="ticket_type", type="string", length=8)
  220.      */
  221.     protected $ticketType self::TICKET_TYPE_GENERAL_ADMISSION;
  222.     /**
  223.      * @var Collection|SeatingChartImage[]|null
  224.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Ticket\SeatingChartImage", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  225.      * @Serialize\Expose
  226.      */
  227.     protected ?Collection $seatingChartImages null;
  228.     /**
  229.      * @ORM\Column(name="ticket_quantity", type="integer", nullable=true);
  230.      * @Assert\NotNull
  231.      * @Assert\Range(min=0)
  232.      */
  233.     protected $ticketQuantity 0;
  234.     /**
  235.      * @ORM\Column(name="ticket_end", type="datetime", nullable=true);
  236.      */
  237.     protected $ticketEnd;
  238.     /**
  239.      * @var Collection|Ticket[]|null
  240.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Ticket\Ticket", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  241.      */
  242.     protected ?Collection $tickets null;
  243.     /**
  244.      * @var Collection|TicketType[]|null
  245.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Ticket\TicketType", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  246.      * @ORM\OrderBy({"sortOrder" = "ASC", "admissionAmount" = "DESC"})
  247.      */
  248.     protected ?Collection $ticketTypes null;
  249.     /**
  250.      * @ORM\Column(name="ticket_display_name", type="text", length=20);
  251.      * @Serialize\Expose
  252.      */
  253.     protected $ticketDisplayName 'Ticket';
  254.     /**
  255.      * @ORM\Column(name="shop_display_name", type="text", length=20);
  256.      * @Serialize\Expose
  257.      */
  258.     protected $shopDisplayName 'Shop';
  259.     /**
  260.      * @ORM\Column(name="fundaneed_display_name", type="text", length=20);
  261.      * @Serialize\Expose
  262.      */
  263.     protected $fundANeedDisplayName 'Fund A Need';
  264.     /**
  265.      * @ORM\Column(name="crew_up_setup_display_name", type="text", length=20);
  266.      * @Serialize\Expose
  267.      */
  268.     protected $crewUpSetupDisplayName 'CrewUp';
  269.     /**
  270.      * @ORM\Column(name="crew_up_setup_text_description", type="text", length=1000);
  271.      * @Serialize\Expose
  272.      */
  273.     protected $crewUpSetupTextDescription 'Join our CrewUp for an opportunity to serve and support our mission.';
  274.     /**
  275.      * @ORM\Column(name="paddle_raise_display_name", type="text", length=20);
  276.      * @Serialize\Expose
  277.      */
  278.     protected $paddleRaiseDisplayName 'Paddle Raise';
  279.     /**
  280.      * @ORM\Column(name="raffle_display_name", type="text", length=20);
  281.      * @Serialize\Expose
  282.      */
  283.     protected $raffleDisplayName 'Raffle';
  284.     /**
  285.      * @ORM\Column(name="shop_goal", type="decimal", scale=2, precision=10);
  286.      * @Assert\Range(min=0)
  287.      */
  288.     protected $shopGoal 0;
  289.     /**
  290.      * @ORM\Column(name="fund_a_need_goal", type="decimal", scale=2, precision=10);
  291.      * @Assert\Range(min=0)
  292.      */
  293.     protected $fundANeedGoal 0;
  294.     /**
  295.      * @ORM\Column(name="paddle_raise_goal", type="decimal", scale=2, precision=10);
  296.      * @Assert\Range(min=0)
  297.      */
  298.     protected $paddleRaiseGoal 0;
  299.     /**
  300.      * @ORM\Column(name="external_purchase_display_name", type="text", length=20);
  301.      * @Serialize\Expose
  302.      */
  303.     protected $externalPurchaseDisplayName 'External';
  304.     /**
  305.      * @var Collection|Registration[]|null
  306.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Registration\Registration", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  307.      */
  308.     protected ?Collection $registrations null;
  309.     /**
  310.      * @var Collection|Purchase[]|null
  311.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Purchase\Purchase", mappedBy="campaign", orphanRemoval=true, cascade={"persist", "remove"})
  312.      */
  313.     protected ?Collection $purchases null;
  314.     /**
  315.      * @var Collection|Transaction[]|null
  316.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Transaction\Transaction", mappedBy="campaign", cascade={"persist", "remove"})
  317.      */
  318.     protected ?Collection $transactions null;
  319.     /**
  320.      * @var Collection|CashDonation[]|null
  321.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Donation\CashDonation", mappedBy="campaign", cascade={"persist"})
  322.      */
  323.     protected ?Collection $donations null;
  324.     /**
  325.      * @var Collection|DonationLevel[]|null
  326.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Donation\DonationLevel", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  327.      */
  328.     protected ?Collection $donationLevels null;
  329.     /**
  330.      * @ORM\Column(name="has_item_donations", type="boolean")
  331.      * @Assert\NotNull
  332.      */
  333.     protected $hasItemDonations false;
  334.     /**
  335.      * @ORM\Column(name="has_procurement", type="boolean")
  336.      * @Assert\NotNull
  337.      */
  338.     protected $hasProcurement false;
  339.     /**
  340.      * @var Collection|Item[]|null
  341.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Procurement\Item", mappedBy="campaign", cascade={"remove", "persist"})
  342.      */
  343.     protected ?Collection $donatedItems null;
  344.     /**
  345.      * @ORM\Column(name="has_cash_donations", type="boolean")
  346.      * @Assert\NotNull
  347.      */
  348.     protected $hasCashDonations false;
  349.     /**
  350.      * @ORM\Column(name="has_fund_drive", type="boolean")
  351.      * @Assert\NotNull
  352.      */
  353.     protected $hasFundDrive false;
  354.     /**
  355.      * @ORM\Column(name="fund_drive_name", type="string", length=255, nullable=true);
  356.      */
  357.     protected $fundDriveName;
  358.     /**
  359.      * @ORM\Column(name="fund_drive_begin", type="datetime", nullable=true);
  360.      */
  361.     protected $fundDriveBegin;
  362.     /**
  363.      * @ORM\Column(name="fund_drive_end", type="datetime", nullable=true);
  364.      */
  365.     protected $fundDriveEnd;
  366.     /**
  367.      * An arbitrary string to be displayed on your customer’s credit card statement.
  368.      *
  369.      * @ORM\Column(name="payment_notice", type="string", length=22, nullable=true);
  370.      * @Assert\Regex(
  371.      *     pattern="/[^<>\x22']/",
  372.      *     message="The statement description may not include < > "" ' characters"
  373.      * )
  374.      * @Assert\Length(max = 22)
  375.      */
  376.     protected $paymentNotice;
  377.     /**
  378.      * @var Collection|MembershipLevel[]|null
  379.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Donation\MembershipLevel", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  380.      */
  381.     protected ?Collection $membershipLevels null;
  382.     /**
  383.      * @ORM\Column(name="has_membership", type="boolean")
  384.      * @Assert\NotNull
  385.      */
  386.     protected $hasMembership false;
  387.     /**
  388.      * @ORM\Column(name="membership_begin", type="datetime", nullable=true);
  389.      */
  390.     protected $membershipBegin;
  391.     /**
  392.      * @ORM\Column(name="membership_end", type="datetime", nullable=true);
  393.      */
  394.     protected $membershipEnd;
  395.     /**
  396.      * @ORM\Column(name="encourage_cash_donations", type="boolean")
  397.      * @Assert\NotNull
  398.      */
  399.     protected $encourageCashDonations true;
  400.     /**
  401.      * @ORM\Column(name="show_cash_donations", type="boolean")
  402.      * @Assert\NotNull
  403.      */
  404.     protected $showCashDonations true;
  405.     /**
  406.      * @ORM\Column(name="goal_cash_donations", type="decimal", scale=2, precision=10);
  407.      * @Assert\Range(min=0)
  408.      */
  409.     protected $cashDonationGoal 0;
  410.     /**
  411.      * @ORM\Column(name="goal_cash_donation_display", type="boolean")
  412.      * @Assert\NotNull
  413.      */
  414.     protected $displayCashDonationGoal false;
  415.     /**
  416.      * @ORM\Column(name="goal_cash_donation_display_progress", type="boolean")
  417.      * @Assert\NotNull
  418.      */
  419.     protected $displayCashDonationGoalProgress false;
  420.     /**
  421.      * @var Collection|CryptoWallet[]|null
  422.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Donation\CryptoWallet", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  423.      */
  424.     protected ?Collection $cryptoWallets null;
  425.     /**
  426.      * @ORM\Column(name="has_registrations", type="boolean")
  427.      * @Serialize\Expose
  428.      */
  429.     protected $hasRegistrations false;
  430.     /**
  431.      * @var Collection|RaffleType[]|null
  432.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Raffle\RaffleType", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  433.      */
  434.     protected ?Collection $raffleTypes null;
  435.     /**
  436.      * @var Collection|RegistrationType[]|null
  437.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Registration\RegistrationType", mappedBy="campaign", orphanRemoval=true, cascade={"persist"})
  438.      */
  439.     protected ?Collection $registrationTypes null;
  440.     /**
  441.      * @ORM\Column(name="require_registration_waiver", type="boolean")
  442.      * @Assert\NotNull
  443.      */
  444.     protected $requireRegistrationWaiver false;
  445.     /**
  446.      * @ORM\Column(name="registration_waiver", type="text", nullable=true);
  447.      */
  448.     protected $registrationWaiver;
  449.     /**
  450.      * @ORM\Column(name="registration_start", type="datetime", nullable=true);
  451.      */
  452.     protected $registrationStart;
  453.     /**
  454.      * @ORM\Column(name="registration_end", type="datetime", nullable=true);
  455.      */
  456.     protected $registrationEnd;
  457.     /**
  458.      * @ORM\Column(name="has_paddle_raise", type="boolean", nullable=true)
  459.      */
  460.     protected $hasPaddleRaise false;
  461.     /**
  462.      * @ORM\Column(name="show_paddle_raise_mobile", type="boolean", nullable=true)
  463.      */
  464.     protected $showPaddleRaiseMobileBtn false;
  465.     /**
  466.      * @ORM\Column(name="has_display_feeds", type="boolean", nullable=true)
  467.      */
  468.     protected $hasDisplayFeeds false;
  469.     /**
  470.      * @ORM\Column(name="has_volunteers", type="boolean", nullable=true)
  471.      */
  472.     protected $hasVolunteers false;
  473.     /**
  474.      * @ORM\Embedded(class="Theme", columnPrefix="campaign_")
  475.      * @Assert\Valid
  476.      */
  477.     protected ?Theme $theme null;
  478.     /**
  479.      * @ORM\ManyToOne(targetEntity="Image", cascade={"remove", "persist"})
  480.      * @ORM\JoinColumn(name="banner_image_id", referencedColumnName="id", onDelete="CASCADE")
  481.      * @Serialize\Expose
  482.      */
  483.     protected ?Image $bannerImage null;
  484.     /**
  485.      * @ORM\ManyToOne(targetEntity="Image", cascade={"remove", "persist"})
  486.      * @ORM\JoinColumn(name="logo_image_id", referencedColumnName="id", onDelete="CASCADE")
  487.      * @Serialize\Expose
  488.      */
  489.     protected ?Image $logo null;
  490.     /**
  491.      * @ORM\Column(name="timezone", type="string", length=100);
  492.      */
  493.     protected $timezone;
  494.     /**
  495.      * @ORM\Column(name="perpetual", type="boolean")
  496.      */
  497.     protected $perpetual false;
  498.     /**
  499.      * @ORM\Column(name="pay_by_check", type="boolean")
  500.      */
  501.     protected $payByCheck false;
  502.     /**
  503.      * @ORM\Column(name="hold_items_in_cart", type="boolean")
  504.      * @Serialize\Expose
  505.      */
  506.     protected $holdItemsInCart false;
  507.     /**
  508.      * @ORM\Column(name="allow_custom_payment_instructions", type="boolean")
  509.      */
  510.     protected $allowCustomPaymentInstructions false;
  511.     /**
  512.      * @ORM\Column(name="custom_payment_instructions", type="text", nullable=true)
  513.      */
  514.     protected $customPaymentInstructions;
  515.     /**
  516.      * @ORM\Column(name="donation_text", type="text", nullable=true)
  517.      */
  518.     protected $donationText;
  519.     /**
  520.      * @ORM\Column(name="sms_reply", type="string", length=20, nullable=true)
  521.      */
  522.     protected $smsReply;
  523.     /**
  524.      * @ORM\Column(name="has_raffle", type="boolean")
  525.      */
  526.     protected $hasRaffle false;
  527.     /**
  528.      * @ORM\Column(name="raffle_start", type="datetime", nullable=true);
  529.      */
  530.     protected $raffleStart;
  531.     /**
  532.      * @ORM\Column(name="raffle_end", type="datetime", nullable=true);
  533.      */
  534.     protected $raffleEnd;
  535.     /**
  536.      * @ORM\Column(name="raffle_show_winners_on_homepage", type="boolean", options={"default" : 0})
  537.      */
  538.     protected $raffleShowWinnersOnHomepage false;
  539.     /**
  540.      * @ORM\OneToOne(
  541.      *     targetEntity="Bidcoz\Bundle\CoreBundle\Entity\TwilioCampaign",
  542.      *     mappedBy="campaign",
  543.      *     orphanRemoval=true,
  544.      *     cascade={"persist", "refresh"}
  545.      * )
  546.      */
  547.     protected ?TwilioCampaign $twilioCampaign null;
  548.     /**
  549.      * Fees are stored in integer field in DB as (value * 100), e.g. 5% = 500.
  550.      *
  551.      * @ORM\Column(name="fees", type="smallint", options={"default":500})
  552.      * @Assert\Range(
  553.      *     min = 0,
  554.      *     max = 1000,
  555.      *     notInRangeMessage = "Fees must be between 0% and 10%"
  556.      * )
  557.      */
  558.     protected $fees 500;
  559.     /**
  560.      * @var Collection|CampaignDetail[]|null
  561.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Contact\CampaignDetail", mappedBy="campaign", orphanRemoval=true, cascade={"persist", "remove"})
  562.      */
  563.     protected ?Collection $campaignDetails null;
  564.     /**
  565.      * @var Collection|BidNumber[]|null
  566.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Auction\BidNumber", mappedBy="campaign", cascade={"persist", "remove"})
  567.      */
  568.     protected ?Collection $bidNumbers null;
  569.     /**
  570.      * @var Collection|TicketGroup[]|null
  571.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Ticket\TicketGroup", mappedBy="campaign", cascade={"persist", "remove"})
  572.      */
  573.     protected ?Collection $ticketGroups null;
  574.     /**
  575.      * @var Collection|ItemTemplate[]|null
  576.      * @ORM\OneToMany(targetEntity="Bidcoz\Bundle\CoreBundle\Entity\Email\ItemTemplate", mappedBy="campaign", cascade={"persist", "remove"})
  577.      */
  578.     protected ?Collection $itemTemplates null;
  579.     /**
  580.      * @ORM\Column(name="send_purchase_email", type="boolean")
  581.      * @Serialize\Expose
  582.      */
  583.     protected $sendPurchaseEmail true;
  584.     /**
  585.      * @ORM\Column(name="send_paddle_raise_email", type="boolean")
  586.      * @Serialize\Expose
  587.      */
  588.     protected $sendPaddleRaiseEmail true;
  589.     /**
  590.      * @ORM\Column(name="meta_pixel_id", type="string", length=50, nullable=true)
  591.      */
  592.     protected $metaPixelId;
  593.     /**
  594.      * @ORM\Column(name="google_ads_conversion_id", type="string", length=50, nullable=true)
  595.      */
  596.     protected $googleAdsConversionId;
  597.     /**
  598.      * @ORM\Column(name="google_ads_conversion_label", type="string", length=50, nullable=true)
  599.      */
  600.     protected $googleAdsConversionLabel;
  601.     /**
  602.      * @ORM\Column(name="created_at", type="datetime")
  603.      * @Serialize\Expose
  604.      */
  605.     protected $createdAt;
  606.     public function __construct(Organization $organization)
  607.     {
  608.         $this->organization      $organization;
  609.         $this->sponsorships      = new ArrayCollection();
  610.         $this->tickets           = new ArrayCollection();
  611.         $this->ticketTypes       = new ArrayCollection();
  612.         $this->purchases         = new ArrayCollection();
  613.         $this->donations         = new ArrayCollection();
  614.         $this->registrationTypes = new ArrayCollection();
  615.         $this->raffleTypes       = new ArrayCollection();
  616.         $this->campaignDetails   = new ArrayCollection();
  617.         $this->theme             = new Theme();
  618.         $this->timezone          self::DEFAULT_TIMEZONE;
  619.         $this->createdAt         = new DateTime();
  620.     }
  621.     public function setId(?int $id): void
  622.     {
  623.         $this->id $id;
  624.     }
  625.     public function getId()
  626.     {
  627.         return $this->id;
  628.     }
  629.     public function setName($name)
  630.     {
  631.         $this->name $name;
  632.     }
  633.     public function getName()
  634.     {
  635.         return $this->name;
  636.     }
  637.     public function setSlug($slug)
  638.     {
  639.         $this->slug $slug;
  640.     }
  641.     public function getSlug()
  642.     {
  643.         return $this->slug;
  644.     }
  645.     public function getOrganization()
  646.     {
  647.         return $this->organization;
  648.     }
  649.     public function setOrganization(Organization $organization)
  650.     {
  651.         $this->organization $organization;
  652.     }
  653.     public function setActive($active)
  654.     {
  655.         $this->active $active;
  656.     }
  657.     public function isActive()
  658.     {
  659.         return $this->active;
  660.     }
  661.     public function setDescription($description)
  662.     {
  663.         $this->description $description;
  664.     }
  665.     public function getDescription()
  666.     {
  667.         return $this->description;
  668.     }
  669.     public function setHeroDescription($heroDescription)
  670.     {
  671.         $this->heroDescription $heroDescription;
  672.     }
  673.     public function getHeroDescription()
  674.     {
  675.         return $this->heroDescription;
  676.     }
  677.     public function setFeeType(string $feeType)
  678.     {
  679.         $this->feeType $feeType;
  680.     }
  681.     public function getFeeType()
  682.     {
  683.         return $this->feeType;
  684.     }
  685.     public function isUserChoiceFeeType(): bool
  686.     {
  687.         return self::FEE_CHOICE == $this->getFeeType();
  688.     }
  689.     public function setTransactionFeePassthrough(bool $transactionFeePassthrough)
  690.     {
  691.         $this->transactionFeePassthrough $transactionFeePassthrough;
  692.     }
  693.     public function getTransactionFeePassthrough(): bool
  694.     {
  695.         return $this->transactionFeePassthrough;
  696.     }
  697.     public function setCollectCcInfo(bool $collectCcInfo)
  698.     {
  699.         $this->collectCcInfo $collectCcInfo;
  700.     }
  701.     public function getCollectCcInfo(): bool
  702.     {
  703.         return $this->collectCcInfo && ($this->hasAuction() || $this->hasTickets());
  704.     }
  705.     public static function getFeeChoices(Organization $organization null)
  706.     {
  707.         return [
  708.             self::FEE_USER   => 'Require Users to pay Fee',
  709.             self::FEE_CHOICE => 'Offer Users the option to decline Fee',
  710.         ];
  711.     }
  712.     public function getCurrency()
  713.     {
  714.         return $this->organization->getCurrency();
  715.     }
  716.     public function isOver()
  717.     {
  718.         $now = new DateTime();
  719.         return $now $this->campaignEnd;
  720.     }
  721.     /**
  722.      * @Assert\Callback
  723.      */
  724.     public function ensureFundDriveDatesValid(ExecutionContextInterface $context)
  725.     {
  726.         if ($this->fundDriveBegin && $this->fundDriveEnd && $this->fundDriveBegin $this->fundDriveEnd) {
  727.             $context->buildViolation('Appeal Start must be before Appeal End')
  728.                 ->atPath('fundDriveBegin')
  729.                 ->addViolation();
  730.         }
  731.     }
  732.     /**
  733.      * @Assert\Callback
  734.      */
  735.     public function ensureMembershipDatesValid(ExecutionContextInterface $context)
  736.     {
  737.         if ($this->membershipBegin && $this->membershipEnd && $this->membershipBegin $this->membershipEnd) {
  738.             $context->buildViolation('Membership Start must be before Membership End')
  739.                 ->atPath('membershipBegin')
  740.                 ->addViolation();
  741.         }
  742.     }
  743.     public function setHasAuction($hasAuction)
  744.     {
  745.         $this->hasAuction $hasAuction;
  746.     }
  747.     public function getHasAuction()
  748.     {
  749.         return $this->hasAuction;
  750.     }
  751.     public function hasAuction()
  752.     {
  753.         return $this->hasAuction;
  754.     }
  755.     public function auctionAvailable(): bool
  756.     {
  757.         if (!$this->hasAuction) {
  758.             return false;
  759.         }
  760.         return $this->getAuction()->isAvailable();
  761.     }
  762.     public function setHasShop($hasShop)
  763.     {
  764.         $this->hasShop $hasShop;
  765.     }
  766.     public function getHasShop()
  767.     {
  768.         return $this->hasShop;
  769.     }
  770.     public function hasShop()
  771.     {
  772.         return $this->hasShop;
  773.     }
  774.     public function shopAvailable(): bool
  775.     {
  776.         return $this->hasShop;
  777.     }
  778.     public function setHasFundANeed($hasFundANeed)
  779.     {
  780.         $this->hasFundANeed $hasFundANeed;
  781.     }
  782.     public function getHasFundANeed()
  783.     {
  784.         return $this->hasFundANeed;
  785.     }
  786.     public function hasFundANeed()
  787.     {
  788.         return $this->hasFundANeed;
  789.     }
  790.     public function fundANeedAvailable(): bool
  791.     {
  792.         return $this->hasFundANeed;
  793.     }
  794.     public function setAuction(?Auction $auction): void
  795.     {
  796.         $this->auction $auction;
  797.     }
  798.     public function getAuction(): ?Auction
  799.     {
  800.         return $this->auction && Auction::class == get_class($this->auction)
  801.             ? $this->auction
  802.             null;
  803.     }
  804.     public function setShop(?Shop $shop)
  805.     {
  806.         $this->shop $shop;
  807.     }
  808.     public function getShop(): ?Shop
  809.     {
  810.         return $this->shop;
  811.     }
  812.     public function setFundANeed(?FundANeed $fundANeed)
  813.     {
  814.         $this->fundANeed $fundANeed;
  815.     }
  816.     public function getFundANeed(): ?FundANeed
  817.     {
  818.         return $this->fundANeed;
  819.     }
  820.     public function setHasSponsorship($hasSponsorship)
  821.     {
  822.         $this->hasSponsorship $hasSponsorship;
  823.     }
  824.     public function getHasSponsorship()
  825.     {
  826.         return $this->hasSponsorship;
  827.     }
  828.     public function setSponsorshipSignup($sponsorshipSignup)
  829.     {
  830.         $this->sponsorshipSignup $sponsorshipSignup;
  831.     }
  832.     public function getSponsorshipSignup()
  833.     {
  834.         return $this->sponsorshipSignup;
  835.     }
  836.     public function setHasTickets($hasTickets)
  837.     {
  838.         $this->hasTickets $hasTickets;
  839.     }
  840.     public function getHasTickets()
  841.     {
  842.         return $this->hasTickets;
  843.     }
  844.     public function hasTickets()
  845.     {
  846.         return $this->hasTickets;
  847.     }
  848.     public function setTicketType($ticketType)
  849.     {
  850.         $this->ticketType $ticketType;
  851.     }
  852.     public function getTicketType()
  853.     {
  854.         return $this->ticketType ?: self::TICKET_TYPE_GENERAL_ADMISSION;
  855.     }
  856.     public static function getTicketTypeChoices()
  857.     {
  858.         return [
  859.             self::TICKET_TYPE_GENERAL_ADMISSION => 'General Admission',
  860.             // self::TICKET_TYPE_RESERVED          => 'Reserved Seating',
  861.             self::TICKET_TYPE_ASSIGNED          => 'Assigned Seating',
  862.         ];
  863.     }
  864.     public function hasSelfCheckIn()
  865.     {
  866.         return null !== $this->selfCheckInDate;
  867.     }
  868.     public function setSelfCheckInDate(DateTime $selfCheckInDate null)
  869.     {
  870.         $this->selfCheckInDate $selfCheckInDate;
  871.     }
  872.     public function getSelfCheckInDate()
  873.     {
  874.         return $this->selfCheckInDate;
  875.     }
  876.     public function selfCheckInAvailable(): bool
  877.     {
  878.         $now = new DateTime();
  879.         return $this->hasSelfCheckIn() && $now $this->getSelfCheckInDate();
  880.     }
  881.     public function hasTicketAssignment()
  882.     {
  883.         return in_array($this->getTicketType(), [
  884.             // self::TICKET_TYPE_RESERVED,
  885.             self::TICKET_TYPE_ASSIGNED,
  886.         ]);
  887.     }
  888.     public function isReservedSeating()
  889.     {
  890.         // return self::TICKET_TYPE_RESERVED === $this->getTicketType();
  891.         return;
  892.     }
  893.     public function getSeatingChartImages()
  894.     {
  895.         return $this->seatingChartImages;
  896.     }
  897.     public function addSeatingChartImage(SeatingChartImage $image)
  898.     {
  899.         if (!$this->seatingChartImages->contains($image)) {
  900.             $this->seatingChartImages->add($image);
  901.         }
  902.     }
  903.     public function removeSeatingChartImage(SeatingChartImage $image)
  904.     {
  905.         if ($this->seatingChartImages->contains($image)) {
  906.             $this->seatingChartImages->removeElement($image);
  907.         }
  908.     }
  909.     public function setPrimarySeatingChartImage(SeatingChartImage $image)
  910.     {
  911.         foreach ($this->seatingChartImages as $i) {
  912.             $i->setPrimary(false);
  913.         }
  914.         $image->setPrimary(true);
  915.     }
  916.     public function getPrimarySeatingChartImage()
  917.     {
  918.         $filtered $this->getSeatingChartImages()->filter(function ($image) {
  919.             return $image->isPrimary();
  920.         });
  921.         return $filtered->first();
  922.     }
  923.     public function setTicketQuantity($ticketQuantity)
  924.     {
  925.         $this->ticketQuantity $ticketQuantity;
  926.     }
  927.     public function getTicketQuantity()
  928.     {
  929.         return $this->ticketQuantity;
  930.     }
  931.     public function setTicketEnd(DateTime $date)
  932.     {
  933.         $this->ticketEnd $date;
  934.     }
  935.     public function getTicketEnd()
  936.     {
  937.         return $this->ticketEnd;
  938.     }
  939.     public function setDetailsTitle($detailsTitle)
  940.     {
  941.         $this->detailsTitle $detailsTitle;
  942.     }
  943.     public function getDetailsTitle()
  944.     {
  945.         return $this->detailsTitle;
  946.     }
  947.     public function setDetailsBody($detailsBody)
  948.     {
  949.         $this->detailsBody $detailsBody;
  950.     }
  951.     public function getDetailsBody()
  952.     {
  953.         return $this->detailsBody;
  954.     }
  955.     public function setHomepageContent($homepageContent)
  956.     {
  957.         $this->homepageContent $homepageContent;
  958.     }
  959.     public function getHomepageContent()
  960.     {
  961.         return $this->homepageContent;
  962.     }
  963.     public function setVideo(VideoEmbed $video)
  964.     {
  965.         $this->video $video;
  966.     }
  967.     public function getVideo()
  968.     {
  969.         return $this->video;
  970.     }
  971.     public function ticketsAvailable()
  972.     {
  973.         // TODO
  974.         return true;
  975.     }
  976.     public function getTickets()
  977.     {
  978.         return $this->tickets;
  979.     }
  980.     public function getTicketTypes()
  981.     {
  982.         return $this->ticketTypes;
  983.     }
  984.     public function addTicketType(TicketType $ticketType): void
  985.     {
  986.         if (!$this->ticketTypes->contains($ticketType)) {
  987.             $this->ticketTypes->add($ticketType);
  988.         }
  989.     }
  990.     public function removeTicketType(TicketType $ticketType): void
  991.     {
  992.         if ($this->ticketTypes->contains($ticketType)) {
  993.             $this->ticketTypes->removeElement($ticketType);
  994.         }
  995.     }
  996.     public function setTicketDisplayName(string $ticketDisplayName)
  997.     {
  998.         $this->ticketDisplayName $ticketDisplayName;
  999.     }
  1000.     public function getTicketDisplayName(): string
  1001.     {
  1002.         return $this->ticketDisplayName;
  1003.     }
  1004.     public function setShopDisplayName(string $shopDisplayName)
  1005.     {
  1006.         $this->shopDisplayName $shopDisplayName;
  1007.     }
  1008.     public function getShopDisplayName(): string
  1009.     {
  1010.         return $this->shopDisplayName;
  1011.     }
  1012.     public function setFundANeedDisplayName(string $fundANeedDisplayName)
  1013.     {
  1014.         $this->fundANeedDisplayName $fundANeedDisplayName;
  1015.     }
  1016.     public function getPaddleRaiseDisplayName(): string
  1017.     {
  1018.         return $this->paddleRaiseDisplayName;
  1019.     }
  1020.     public function setPaddleRaiseDisplayName(string $paddleRaiseDisplayName)
  1021.     {
  1022.         $this->paddleRaiseDisplayName $paddleRaiseDisplayName;
  1023.     }
  1024.     public function getRaffleDisplayName(): string
  1025.     {
  1026.         return $this->raffleDisplayName;
  1027.     }
  1028.     public function setRaffleDisplayName(string $raffleDisplayName)
  1029.     {
  1030.         $this->raffleDisplayName $raffleDisplayName;
  1031.     }
  1032.     public function getFundANeedDisplayName(): string
  1033.     {
  1034.         return $this->fundANeedDisplayName;
  1035.     }
  1036.     public function setExternalPurchaseDisplayName(string $externalPurchaseDisplayName)
  1037.     {
  1038.         $this->externalPurchaseDisplayName $externalPurchaseDisplayName;
  1039.     }
  1040.     public function getExternalPurchaseDisplayName(): string
  1041.     {
  1042.         return $this->externalPurchaseDisplayName;
  1043.     }
  1044.     public function setHasItemDonations($hasItemDonations)
  1045.     {
  1046.         $this->hasItemDonations $hasItemDonations;
  1047.     }
  1048.     public function getHasItemDonations()
  1049.     {
  1050.         return $this->hasProcurement && $this->hasItemDonations;
  1051.     }
  1052.     public function setHasProcurement($hasProcurement)
  1053.     {
  1054.         $this->hasProcurement $hasProcurement;
  1055.     }
  1056.     public function getHasProcurement()
  1057.     {
  1058.         return $this->hasProcurement;
  1059.     }
  1060.     public function setHasCashDonations($hasCashDonations)
  1061.     {
  1062.         $this->hasCashDonations $hasCashDonations;
  1063.     }
  1064.     public function getHasCashDonations()
  1065.     {
  1066.         return $this->hasCashDonations;
  1067.     }
  1068.     public function hasCashDonations()
  1069.     {
  1070.         return $this->hasCashDonations;
  1071.     }
  1072.     public function setHasFundDrive($hasFundDrive)
  1073.     {
  1074.         $this->hasFundDrive $hasFundDrive;
  1075.     }
  1076.     public function getHasFundDrive()
  1077.     {
  1078.         return $this->hasFundDrive;
  1079.     }
  1080.     public function isFundDriveEnabled()
  1081.     {
  1082.         $now = new DateTime();
  1083.         return $this->hasFundDrive                                   &&
  1084.             (!$this->fundDriveBegin || $this->fundDriveBegin $now) &&
  1085.             (!$this->fundDriveEnd   || $this->fundDriveEnd $now);
  1086.     }
  1087.     public function hasFundDrive()
  1088.     {
  1089.         return $this->hasFundDrive;
  1090.     }
  1091.     public function setFundDriveName($fundDriveName)
  1092.     {
  1093.         $this->fundDriveName $fundDriveName;
  1094.     }
  1095.     public function getFundDriveName()
  1096.     {
  1097.         return $this->fundDriveName;
  1098.     }
  1099.     public function setFundDriveBegin(DateTime $fundDriveBegin null)
  1100.     {
  1101.         $this->fundDriveBegin $fundDriveBegin;
  1102.     }
  1103.     public function getFundDriveBegin()
  1104.     {
  1105.         return $this->fundDriveBegin;
  1106.     }
  1107.     public function setFundDriveEnd(DateTime $fundDriveEnd null)
  1108.     {
  1109.         $this->fundDriveEnd $fundDriveEnd;
  1110.     }
  1111.     public function getFundDriveEnd()
  1112.     {
  1113.         return $this->fundDriveEnd;
  1114.     }
  1115.     public function setPaymentNotice($paymentNotice)
  1116.     {
  1117.         $this->paymentNotice $paymentNotice;
  1118.     }
  1119.     public function getPaymentNotice()
  1120.     {
  1121.         return $this->paymentNotice;
  1122.     }
  1123.     public function getDonationLevels(): ?Collection
  1124.     {
  1125.         return $this->donationLevels;
  1126.     }
  1127.     public function setDonationLevels(?Collection $donationLevels): void
  1128.     {
  1129.         $this->donationLevels $donationLevels;
  1130.     }
  1131.     public function getMembershipLevels()
  1132.     {
  1133.         return $this->membershipLevels;
  1134.     }
  1135.     public function setHasMembership($hasMembership)
  1136.     {
  1137.         $this->hasMembership $hasMembership;
  1138.     }
  1139.     public function getHasMembership()
  1140.     {
  1141.         return $this->hasMembership;
  1142.     }
  1143.     public function isMembershipEnabled()
  1144.     {
  1145.         $now = new DateTime();
  1146.         return $this->hasMembership                                &&
  1147.         (!$this->membershipBegin || $this->membershipBegin $now) &&
  1148.         (!$this->membershipEnd   || $this->membershipEnd $now);
  1149.     }
  1150.     public function hasMembership()
  1151.     {
  1152.         return $this->hasMembership;
  1153.     }
  1154.     public function setMembershipBegin(DateTime $membershipBegin null)
  1155.     {
  1156.         $this->membershipBegin $membershipBegin;
  1157.     }
  1158.     public function getMembershipBegin()
  1159.     {
  1160.         return $this->membershipBegin;
  1161.     }
  1162.     public function setMembershipEnd(DateTime $membershipEnd null)
  1163.     {
  1164.         $this->membershipEnd $membershipEnd;
  1165.     }
  1166.     public function getMembershipEnd()
  1167.     {
  1168.         return $this->membershipEnd;
  1169.     }
  1170.     public function setEncourageCashDonations($encourageCashDonations)
  1171.     {
  1172.         $this->encourageCashDonations $encourageCashDonations;
  1173.     }
  1174.     public function getEncourageCashDonations()
  1175.     {
  1176.         return $this->encourageCashDonations;
  1177.     }
  1178.     public function setShowCashDonations($showCashDonations)
  1179.     {
  1180.         $this->showCashDonations $showCashDonations;
  1181.     }
  1182.     public function getShowCashDonations()
  1183.     {
  1184.         return $this->showCashDonations;
  1185.     }
  1186.     public function setCashDonationGoal($cashDonationGoal)
  1187.     {
  1188.         $this->cashDonationGoal $cashDonationGoal;
  1189.     }
  1190.     public function getCashDonationGoal()
  1191.     {
  1192.         return $this->cashDonationGoal;
  1193.     }
  1194.     public function setDisplayCashDonationGoal($displayCashDonationGoal)
  1195.     {
  1196.         $this->displayCashDonationGoal $displayCashDonationGoal;
  1197.     }
  1198.     public function getDisplayCashDonationGoal()
  1199.     {
  1200.         return $this->displayCashDonationGoal;
  1201.     }
  1202.     public function setDisplayCashDonationGoalProgress($displayCashDonationGoalProgress)
  1203.     {
  1204.         $this->displayCashDonationGoalProgress $displayCashDonationGoalProgress;
  1205.     }
  1206.     public function getDisplayCashDonationGoalProgress()
  1207.     {
  1208.         return $this->displayCashDonationGoalProgress;
  1209.     }
  1210.     public function getRaffleTypes()
  1211.     {
  1212.         return $this->raffleTypes;
  1213.     }
  1214.     public function setRaffleTypes($raffleTypes): void
  1215.     {
  1216.         $this->raffleTypes $raffleTypes;
  1217.     }
  1218.     public function addRaffleType(RaffleType $raffleType): void
  1219.     {
  1220.         $this->raffleTypes->add($raffleType);
  1221.     }
  1222.     public function removeRaffleType(RaffleType $raffleType): void
  1223.     {
  1224.         $this->raffleTypes->removeElement($raffleType);
  1225.     }
  1226.     public function getActiveRaffles()
  1227.     {
  1228.         return $this->raffleTypes->filter(function (RaffleType $raffleType) {
  1229.             return $raffleType->isActive();
  1230.         });
  1231.     }
  1232.     public function setHasRegistrations($hasRegistrations)
  1233.     {
  1234.         $this->hasRegistrations $hasRegistrations;
  1235.     }
  1236.     public function getHasRegistrations()
  1237.     {
  1238.         return $this->hasRegistrations;
  1239.     }
  1240.     public function getRegistrationTypes()
  1241.     {
  1242.         return $this->registrationTypes;
  1243.     }
  1244.     public function getCryptoWallets()
  1245.     {
  1246.         return $this->cryptoWallets;
  1247.     }
  1248.     public function setRequireRegistrationWaiver($requireRegistrationWaiver)
  1249.     {
  1250.         $this->requireRegistrationWaiver $requireRegistrationWaiver;
  1251.     }
  1252.     public function getRequireRegistrationWaiver()
  1253.     {
  1254.         return $this->requireRegistrationWaiver;
  1255.     }
  1256.     public function setRegistrationWaiver($registrationWaiver)
  1257.     {
  1258.         $this->registrationWaiver $registrationWaiver;
  1259.     }
  1260.     public function getRegistrationWaiver()
  1261.     {
  1262.         return $this->registrationWaiver;
  1263.     }
  1264.     public function setRegistrationStart($registrationStart)
  1265.     {
  1266.         $this->registrationStart $registrationStart;
  1267.     }
  1268.     public function getRegistrationStart()
  1269.     {
  1270.         return $this->registrationStart;
  1271.     }
  1272.     public function setRegistrationEnd($registrationEnd)
  1273.     {
  1274.         $this->registrationEnd $registrationEnd;
  1275.     }
  1276.     public function getRegistrationEnd()
  1277.     {
  1278.         return $this->registrationEnd;
  1279.     }
  1280.     public function isRegistrationActive()
  1281.     {
  1282.         $now = new DateTime();
  1283.         return $now >= $this->registrationStart && $now <= $this->registrationEnd;
  1284.     }
  1285.     public function setHasPaddleRaise($hasPaddleRaise)
  1286.     {
  1287.         $this->hasPaddleRaise $hasPaddleRaise;
  1288.     }
  1289.     public function getHasPaddleRaise()
  1290.     {
  1291.         return $this->hasPaddleRaise;
  1292.     }
  1293.     public function hasPaddleRaise()
  1294.     {
  1295.         return $this->hasPaddleRaise;
  1296.     }
  1297.     public function setShowPaddleRaiseMobileBtn($showPaddleRaiseMobileBtn)
  1298.     {
  1299.         $this->showPaddleRaiseMobileBtn $showPaddleRaiseMobileBtn;
  1300.     }
  1301.     public function getShowPaddleRaiseMobileBtn()
  1302.     {
  1303.         return $this->showPaddleRaiseMobileBtn;
  1304.     }
  1305.     public function setHasDisplayFeeds($hasDisplayFeeds)
  1306.     {
  1307.         $this->hasDisplayFeeds $hasDisplayFeeds;
  1308.     }
  1309.     public function getHasDisplayFeeds()
  1310.     {
  1311.         return $this->hasDisplayFeeds;
  1312.     }
  1313.     public function setHasVolunteers(bool $hasVolunteers)
  1314.     {
  1315.         $this->hasVolunteers $hasVolunteers;
  1316.     }
  1317.     public function getHasVolunteers(): bool
  1318.     {
  1319.         return (bool) $this->hasVolunteers;
  1320.     }
  1321.     public function setTheme(?Theme $theme)
  1322.     {
  1323.         $this->theme $theme;
  1324.     }
  1325.     public function getTheme()
  1326.     {
  1327.         return $this->theme;
  1328.     }
  1329.     public function setBannerImage(?Image $image)
  1330.     {
  1331.         $this->bannerImage $image;
  1332.     }
  1333.     public function removeBannerImage(): void
  1334.     {
  1335.         $this->bannerImage null;
  1336.     }
  1337.     public function getBannerImage(): ?Image
  1338.     {
  1339.         return $this->bannerImage;
  1340.     }
  1341.     public function setLogo(?Image $image null)
  1342.     {
  1343.         $this->logo $image;
  1344.     }
  1345.     public function removeLogo()
  1346.     {
  1347.         $this->logo null;
  1348.     }
  1349.     public function getLogo()
  1350.     {
  1351.         return $this->logo;
  1352.     }
  1353.     public function isUrlEditable(): bool
  1354.     {
  1355.         // TODO
  1356.         return !$this->isPerpetual();
  1357.         if (!$this->id) {
  1358.             return true;
  1359.         }
  1360.     }
  1361.     public function getCreatedAt()
  1362.     {
  1363.         return $this->createdAt;
  1364.     }
  1365.     /**
  1366.      * @Assert\Callback
  1367.      */
  1368.     public function isReservedSlug(ExecutionContextInterface $context)
  1369.     {
  1370.         if (!preg_match('#'.Constants::RESERVED_CAMPAIGN_SLUG_REGEX.'#'$this->slug)) {
  1371.             $context->buildViolation('This is a reserved url.')
  1372.                 ->atPath('slug')
  1373.                 ->addViolation();
  1374.         }
  1375.     }
  1376.     public function setPerpetual($perpetual)
  1377.     {
  1378.         $this->perpetual $perpetual;
  1379.     }
  1380.     public function isPerpetual()
  1381.     {
  1382.         return $this->perpetual;
  1383.     }
  1384.     public function setPayByCheck($payByCheck)
  1385.     {
  1386.         $this->payByCheck $payByCheck;
  1387.     }
  1388.     public function isPayByCheck(): bool
  1389.     {
  1390.         return (bool) $this->payByCheck;
  1391.     }
  1392.     public function setHoldItemsInCart(bool $holdItemsInCart)
  1393.     {
  1394.         $this->holdItemsInCart $holdItemsInCart;
  1395.     }
  1396.     public function getHoldItemsInCart(): bool
  1397.     {
  1398.         return (bool) $this->holdItemsInCart;
  1399.     }
  1400.     public function isUseFastList(): bool
  1401.     {
  1402.         // TODO - Currently ONLY CHG, can add db flag later
  1403.         return 'chg' === $this->organization->getSlug();
  1404.     }
  1405.     public function isExternalPaymentAllowed(): bool
  1406.     {
  1407.         return $this->organization->isEnableCustomizations();
  1408.     }
  1409.     public function setAllowCustomPaymentInstructions(bool $allowCustomPaymentInstructions)
  1410.     {
  1411.         $this->allowCustomPaymentInstructions $allowCustomPaymentInstructions;
  1412.     }
  1413.     public function getAllowCustomPaymentInstructions(): bool
  1414.     {
  1415.         return (bool) $this->allowCustomPaymentInstructions;
  1416.     }
  1417.     public function setCustomPaymentInstructions(string $customPaymentInstructions)
  1418.     {
  1419.         $this->customPaymentInstructions $customPaymentInstructions;
  1420.     }
  1421.     public function getCustomPaymentInstructions()
  1422.     {
  1423.         return $this->customPaymentInstructions;
  1424.     }
  1425.     public function showCustomPaymentInstructions(): bool
  1426.     {
  1427.         return (bool) $this->allowCustomPaymentInstructions && $this->customPaymentInstructions;
  1428.     }
  1429.     public function setDonationText(string $donationText null)
  1430.     {
  1431.         $this->donationText $donationText;
  1432.     }
  1433.     public function getDonationText()
  1434.     {
  1435.         return $this->donationText;
  1436.     }
  1437.     public function isLocked()
  1438.     {
  1439.         return in_array($this->slug, ['donate']);
  1440.     }
  1441.     public function isHidden()
  1442.     {
  1443.         return in_array($this->slug, ['tryit']);
  1444.     }
  1445.     public function getCampaign()
  1446.     {
  1447.         return $this;
  1448.     }
  1449.     public function getObjectName()
  1450.     {
  1451.         return 'Campaign';
  1452.     }
  1453.     public function setTimeZone($timezone)
  1454.     {
  1455.         $this->timezone $timezone;
  1456.     }
  1457.     public function getTimezone()
  1458.     {
  1459.         return $this->timezone ?: self::DEFAULT_TIMEZONE;
  1460.     }
  1461.     public function getTrackedParams()
  1462.     {
  1463.         return [
  1464.             'slug'             => 'URL',
  1465.             'feeType'          => 'Fee Type',
  1466.             'hasAuction'       => 'Has Auction',
  1467.             'hasSponsorship'   => 'Has Sponsorship',
  1468.             'hasTickets'       => 'Has Tickets',
  1469.             'hasItemDonations' => 'Has Item Donations',
  1470.             'hasCashDonations' => 'Has Cash Donations',
  1471.         ];
  1472.     }
  1473.     public function hasComponent($component)
  1474.     {
  1475.         if (!isset(self::$components[$component])) {
  1476.             return false;
  1477.         }
  1478.         $property InflectorFactory::create()->build()->camelize('has_'.$component);
  1479.         return $property && isset($this->$property) && $this->$property;
  1480.     }
  1481.     public function setSmsReply(string $smsReply)
  1482.     {
  1483.         $this->smsReply $smsReply;
  1484.     }
  1485.     public function getSmsReply()
  1486.     {
  1487.         return $this->smsReply;
  1488.     }
  1489.     public function setHasRaffle($hasRaffle)
  1490.     {
  1491.         $this->hasRaffle $hasRaffle;
  1492.     }
  1493.     public function getHasRaffle()
  1494.     {
  1495.         return $this->hasRaffle;
  1496.     }
  1497.     public function setRaffleStart(DateTime $raffleStart)
  1498.     {
  1499.         $this->raffleStart $raffleStart;
  1500.     }
  1501.     public function getRaffleStart()
  1502.     {
  1503.         return $this->raffleStart;
  1504.     }
  1505.     public function setRaffleEnd(DateTime $raffleEnd)
  1506.     {
  1507.         $this->raffleEnd $raffleEnd;
  1508.     }
  1509.     public function getRaffleEnd()
  1510.     {
  1511.         return $this->raffleEnd;
  1512.     }
  1513.     public function isRaffleActive(): bool
  1514.     {
  1515.         $now = new DateTime();
  1516.         return $this->hasRaffle && $now $this->raffleStart && $now $this->raffleEnd;
  1517.     }
  1518.     public function setRaffleShowWinnersOnHomepage(bool $raffleShowWinnersOnHomepage)
  1519.     {
  1520.         $this->raffleShowWinnersOnHomepage $raffleShowWinnersOnHomepage;
  1521.     }
  1522.     public function getRaffleShowWinnersOnHomepage(): bool
  1523.     {
  1524.         return $this->raffleShowWinnersOnHomepage;
  1525.     }
  1526.     public function getTwilioCampaign()
  1527.     {
  1528.         return $this->twilioCampaign;
  1529.     }
  1530.     public function setTwilioCampaign($twilioCampaign)
  1531.     {
  1532.         $this->twilioCampaign $twilioCampaign;
  1533.     }
  1534.     public function hasTwilioCampaign()
  1535.     {
  1536.         return (bool) $this->twilioCampaign && $this->twilioCampaign->getId();
  1537.     }
  1538.     /**
  1539.      * @ORM\PreFlush
  1540.      */
  1541.     public function checkTwilioCampaign(PreFlushEventArgs $event)
  1542.     {
  1543.         $em $event->getEntityManager();
  1544.         if ($this->getTwilioCampaign() && empty($this->getTwilioCampaign()->getNumber())) {
  1545.             $em->remove($this->getTwilioCampaign());
  1546.             $this->setTwilioCampaign(null);
  1547.         }
  1548.     }
  1549.     // Fees are stored in integer field as value * 100, e.g. 5% = 500
  1550.     public function getFees()
  1551.     {
  1552.         return $this->fees 100;
  1553.     }
  1554.     public function setFees($fees)
  1555.     {
  1556.         $this->fees = (int) round($fees 100);
  1557.     }
  1558.     /**
  1559.      * @return Collection|CampaignDetail[]|null
  1560.      */
  1561.     public function getCampaignDetails(): ?Collection
  1562.     {
  1563.         return $this->campaignDetails;
  1564.     }
  1565.     public function setCampaignDetails(?Collection $campaignDetails): void
  1566.     {
  1567.         $this->campaignDetails $campaignDetails;
  1568.     }
  1569.     public function addCampaignDetail(CampaignDetail $campaignDetail): void
  1570.     {
  1571.         $this->campaignDetails->add($campaignDetail);
  1572.         $campaignDetail->setCampaign($this);
  1573.     }
  1574.     public function removeCampaignDetail(CampaignDetail $campaignDetail): void
  1575.     {
  1576.         $this->campaignDetails->removeElement($campaignDetail);
  1577.         $campaignDetail->setCampaign(null);
  1578.     }
  1579.     public function getSponsorships(): ?Collection
  1580.     {
  1581.         return $this->sponsorships;
  1582.     }
  1583.     public function setSponsorships(?Collection $sponsorships): void
  1584.     {
  1585.         $this->sponsorships $sponsorships;
  1586.     }
  1587.     public function addSponsorship(Sponsorship $sponsorship): void
  1588.     {
  1589.         if (!$this->sponsorships->contains($sponsorship)) {
  1590.             $this->sponsorships->add($sponsorship);
  1591.             $sponsorship->setCampaign($this);
  1592.         }
  1593.     }
  1594.     public function removeSponsorship(Sponsorship $sponsorship): void
  1595.     {
  1596.         if ($this->sponsorships->contains($sponsorship)) {
  1597.             $this->sponsorships->removeElement($sponsorship);
  1598.             $sponsorship->setCampaign(null);
  1599.         }
  1600.     }
  1601.     public function getSponsorshipLevels(): ?Collection
  1602.     {
  1603.         return $this->sponsorshipLevels;
  1604.     }
  1605.     public function setSponsorshipLevels(?Collection $sponsorshipLevels): void
  1606.     {
  1607.         $this->sponsorshipLevels $sponsorshipLevels;
  1608.     }
  1609.     public function getRegistrations(): ?Collection
  1610.     {
  1611.         return $this->registrations;
  1612.     }
  1613.     public function setRegistrations(?Collection $registrations): void
  1614.     {
  1615.         $this->registrations $registrations;
  1616.     }
  1617.     /**
  1618.      * @return Collection|Purchase[]|null
  1619.      */
  1620.     public function getPurchases(): ?Collection
  1621.     {
  1622.         return $this->purchases;
  1623.     }
  1624.     public function getPaddleRaiseDonationPurchases(): ?Collection
  1625.     {
  1626.         $purchases = new ArrayCollection();
  1627.         foreach ($this->purchases as $purchase) {
  1628.             if ($purchase instanceof PaddleRaiseDonationPurchase) {
  1629.                 $purchases->add($purchase);
  1630.             }
  1631.         }
  1632.         return $purchases;
  1633.     }
  1634.     public function setPurchases(?Collection $purchases): void
  1635.     {
  1636.         $this->purchases $purchases;
  1637.     }
  1638.     public function addPurchase(Purchase $purchase): void
  1639.     {
  1640.         if (!$this->purchases->contains($purchase)) {
  1641.             $this->purchases->add($purchase);
  1642.             $purchase->setCampaign($this);
  1643.         }
  1644.     }
  1645.     public function removePurchase(Purchase $purchase): void
  1646.     {
  1647.         if ($this->purchases->contains($purchase)) {
  1648.             $this->purchases->removeElement($purchase);
  1649.             $purchase->setCampaign(null);
  1650.         }
  1651.     }
  1652.     public function getTransactions(): ?Collection
  1653.     {
  1654.         return $this->transactions;
  1655.     }
  1656.     public function setTransactions(?Collection $transactions): void
  1657.     {
  1658.         $this->transactions $transactions;
  1659.     }
  1660.     public function addTransaction(Transaction $transaction): void
  1661.     {
  1662.         if (!$this->transactions->contains($transaction)) {
  1663.             $this->transactions->add($transaction);
  1664.         }
  1665.     }
  1666.     public function removeTransaction(Transaction $transaction): void
  1667.     {
  1668.         if ($this->transactions->contains($transaction)) {
  1669.             $this->transactions->removeElement($transaction);
  1670.         }
  1671.     }
  1672.     public function getDonations(): ?Collection
  1673.     {
  1674.         return $this->donations;
  1675.     }
  1676.     public function setDonations(?Collection $donations): void
  1677.     {
  1678.         $this->donations $donations;
  1679.     }
  1680.     public function getDonatedItems(): ?Collection
  1681.     {
  1682.         return $this->donatedItems;
  1683.     }
  1684.     public function setDonatedItems(?Collection $donatedItems): void
  1685.     {
  1686.         $this->donatedItems $donatedItems;
  1687.     }
  1688.     public function getBidNumbers(): ?Collection
  1689.     {
  1690.         return $this->bidNumbers;
  1691.     }
  1692.     public function setBidNumbers(?Collection $bidNumbers): void
  1693.     {
  1694.         $this->bidNumbers $bidNumbers;
  1695.     }
  1696.     public function addBidNumber(BidNumber $bidNumber): void
  1697.     {
  1698.         if (!$this->bidNumbers->contains($bidNumber)) {
  1699.             $this->bidNumbers->add($bidNumber);
  1700.         }
  1701.     }
  1702.     public function removeBidNumber(BidNumber $bidNumber): void
  1703.     {
  1704.         if ($this->bidNumbers->contains($bidNumber)) {
  1705.             $this->bidNumbers->removeElement($bidNumber);
  1706.         }
  1707.     }
  1708.     public function getTicketGroups(): ?Collection
  1709.     {
  1710.         return $this->ticketGroups;
  1711.     }
  1712.     public function setTicketGroups(?Collection $ticketGroups): void
  1713.     {
  1714.         $this->ticketGroups $ticketGroups;
  1715.     }
  1716.     public function addTicketGroup(TicketGroup $ticketGroup): void
  1717.     {
  1718.         if (!$this->ticketGroups->contains($ticketGroup)) {
  1719.             $this->ticketGroups->add($ticketGroup);
  1720.         }
  1721.     }
  1722.     public function removeTicketGroup(TicketGroup $ticketGroup): void
  1723.     {
  1724.         if ($this->ticketGroups->contains($ticketGroup)) {
  1725.             $this->ticketGroups->removeElement($ticketGroup);
  1726.         }
  1727.     }
  1728.     public function setShopGoal($goal)
  1729.     {
  1730.         $this->shopGoal $goal;
  1731.     }
  1732.     public function getShopGoal()
  1733.     {
  1734.         return $this->shopGoal;
  1735.     }
  1736.     public function setFundANeedGoal($goal)
  1737.     {
  1738.         $this->fundANeedGoal $goal;
  1739.     }
  1740.     public function getFundANeedGoal()
  1741.     {
  1742.         return $this->fundANeedGoal;
  1743.     }
  1744.     public function setPaddleRaiseGoal($goal)
  1745.     {
  1746.         $this->paddleRaiseGoal $goal;
  1747.     }
  1748.     public function getPaddleRaiseGoal()
  1749.     {
  1750.         return $this->paddleRaiseGoal;
  1751.     }
  1752.     public function setSendPurchaseEmail(bool $sendPurchaseEmail)
  1753.     {
  1754.         $this->sendPurchaseEmail $sendPurchaseEmail;
  1755.     }
  1756.     public function getSendPurchaseEmail(): bool
  1757.     {
  1758.         return $this->sendPurchaseEmail;
  1759.     }
  1760.     public function setSendPaddleRaiseEmail(bool $sendPaddleRaiseEmail)
  1761.     {
  1762.         $this->sendPaddleRaiseEmail $sendPaddleRaiseEmail;
  1763.     }
  1764.     public function getSendPaddleRaiseEmail(): bool
  1765.     {
  1766.         return $this->sendPaddleRaiseEmail;
  1767.     }
  1768.     public function getCrewUpSetupDisplayName(): string
  1769.     {
  1770.         return $this->crewUpSetupDisplayName;
  1771.     }
  1772.     public function setCrewUpSetupDisplayName(string $crewUpSetupDisplayName): self
  1773.     {
  1774.         $this->crewUpSetupDisplayName $crewUpSetupDisplayName;
  1775.         return $this;
  1776.     }
  1777.     public function getCrewUpSetupTextDescription(): ?string
  1778.     {
  1779.         return ($this->crewUpSetupTextDescription === null || $this->crewUpSetupTextDescription === '')
  1780.             ? null
  1781.             $this->crewUpSetupTextDescription;
  1782.     }
  1783.     public function setCrewUpSetupTextDescription(?string $crewUpSetupTextDescription): self
  1784.     {
  1785.         $this->crewUpSetupTextDescription = ($crewUpSetupTextDescription === '' null $crewUpSetupTextDescription);
  1786.         return $this;
  1787.     }
  1788.     public function getMetaPixelId(): ?string
  1789.     {
  1790.         return $this->metaPixelId;
  1791.     }
  1792.     public function setMetaPixelId(?string $metaPixelId): self
  1793.     {
  1794.         $this->metaPixelId = ($metaPixelId === '' null $metaPixelId);
  1795.         return $this;
  1796.     }
  1797.     public function getGoogleAdsConversionId(): ?string
  1798.     {
  1799.         return $this->googleAdsConversionId;
  1800.     }
  1801.     public function setGoogleAdsConversionId(?string $googleAdsConversionId): self
  1802.     {
  1803.         $this->googleAdsConversionId = ($googleAdsConversionId === '' null $googleAdsConversionId);
  1804.         return $this;
  1805.     }
  1806.     public function getGoogleAdsConversionLabel(): ?string
  1807.     {
  1808.         return $this->googleAdsConversionLabel;
  1809.     }
  1810.     public function setGoogleAdsConversionLabel(?string $googleAdsConversionLabel): self
  1811.     {
  1812.         $this->googleAdsConversionLabel = ($googleAdsConversionLabel === '' null $googleAdsConversionLabel);
  1813.         return $this;
  1814.     }
  1815. }