src/Aqarmap/Bundle/ListingBundle/Entity/Listing.php line 77

Open in your IDE?
  1. <?php
  2. namespace Aqarmap\Bundle\ListingBundle\Entity;
  3. use Aqarmap\Bundle\FinancialAidsBundle\Entity\FinancialAid;
  4. use Aqarmap\Bundle\FinancialAidsBundle\Utilities\FinancialAidURL;
  5. use Aqarmap\Bundle\ListingBundle\Constant\CompoundStatus;
  6. use Aqarmap\Bundle\ListingBundle\Constant\EligibleForMortgageData;
  7. use Aqarmap\Bundle\ListingBundle\Constant\ListingCategories;
  8. use Aqarmap\Bundle\ListingBundle\Constant\ListingCustomFields;
  9. use Aqarmap\Bundle\ListingBundle\Constant\ListingFeaturedTypes;
  10. use Aqarmap\Bundle\ListingBundle\Constant\ListingFeatures;
  11. use Aqarmap\Bundle\ListingBundle\Constant\ListingPaymentMethod;
  12. use Aqarmap\Bundle\ListingBundle\Constant\ListingPriceLevel;
  13. use Aqarmap\Bundle\ListingBundle\Constant\ListingPropertyView;
  14. use Aqarmap\Bundle\ListingBundle\Constant\ListingRateConstant;
  15. use Aqarmap\Bundle\ListingBundle\Constant\ListingRateReviewStatus;
  16. use Aqarmap\Bundle\ListingBundle\Constant\ListingRateStatus;
  17. use Aqarmap\Bundle\ListingBundle\Constant\ListingSections;
  18. use Aqarmap\Bundle\ListingBundle\Constant\ListingSellerRoles;
  19. use Aqarmap\Bundle\ListingBundle\Constant\ListingStatus;
  20. use Aqarmap\Bundle\ListingBundle\Constant\PhotoTypes;
  21. use Aqarmap\Bundle\ListingBundle\Constant\PluralCustomFields;
  22. use Aqarmap\Bundle\ListingBundle\Constant\PropertyRegistrationStatusOption;
  23. use Aqarmap\Bundle\ListingBundle\Document\ScrapedListing;
  24. use Aqarmap\Bundle\ListingBundle\Entity\Traits\CallLog;
  25. use Aqarmap\Bundle\ListingBundle\Security\Authorization\OwnerInterface;
  26. use Aqarmap\Bundle\ListingBundle\Validator\Constraints as AqarMapAssert;
  27. use Aqarmap\Bundle\UserBundle\Constant\TeamCategories;
  28. use Aqarmap\Bundle\UserBundle\Entity\User;
  29. use Aqarmap\Bundle\UserBundle\Model\UserMainPhones;
  30. use Doctrine\Common\Collections\ArrayCollection;
  31. use Doctrine\Common\Collections\Collection;
  32. use Doctrine\Common\Collections\Criteria;
  33. use Doctrine\ORM\Mapping as ORM;
  34. use Gedmo\Mapping\Annotation as Gedmo;
  35. use Gedmo\Translatable\Translatable;
  36. use JMS\Serializer\Annotation as Serializer;
  37. use Symfony\Component\Validator\Constraints as Assert;
  38. /**
  39.  * Listing.
  40.  *
  41.  * @ORM\Table(name="listings", indexes={
  42.  *
  43.  *     @ORM\Index(columns={"status"}),
  44.  *     @ORM\Index(columns={"pending_photos_status"}),
  45.  *     @ORM\Index(columns={"pending_payment_status"}),
  46.  *     @ORM\Index(columns={"relist_status"}),
  47.  *     @ORM\Index(columns={"featured"}),
  48.  *     @ORM\Index(columns={"deleted_at"}),
  49.  *     @ORM\Index(columns={"created_at"}),
  50.  *     @ORM\Index(columns={"published_at"}),
  51.  *     @ORM\Index(columns={"synced"}),
  52.  *     @ORM\Index(columns={"user_id", "deleted_at"}),
  53.  *     @ORM\Index(columns={"user_id", "status"}),
  54.  *     @ORM\Index(columns={"user_id", "status", "deleted_at"}),
  55.  *     @ORM\Index(columns={"user_id", "status", "location_id"}),
  56.  *     @ORM\Index(columns={"user_id", "status", "location_id", "parent_id", "category", "deleted_at"}),
  57.  *     @ORM\Index(columns={"user_id", "status", "location_id", "property_type_id", "section_id", "parent_id", "category", "deleted_at"}),
  58.  *     @ORM\Index(columns={"location_id", "section_id", "property_type_id", "status", "published_at"}),
  59.  *     @ORM\Index(columns={"user_id", "section_id", "leads_counter"}),
  60.  *     @ORM\Index(columns={"category", "parent_id", "updated_at"}),
  61.  *     @ORM\Index(columns={"reference_number"}),
  62.  * })
  63.  *
  64.  * @ORM\HasLifecycleCallbacks
  65.  *
  66.  * @ORM\Entity(repositoryClass="Aqarmap\Bundle\ListingBundle\Repository\ListingRepository")
  67.  *
  68.  * @Gedmo\TranslationEntity(class="Aqarmap\Bundle\ListingBundle\Entity\ListingTranslation")
  69.  *
  70.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
  71.  *
  72.  * @Serializer\ExclusionPolicy("all")
  73.  */
  74. class Listing implements OwnerInterfaceTranslatable
  75. {
  76.     use CallLog;
  77.     /**
  78.      * @var int
  79.      *
  80.      * @ORM\Column(name="id", type="integer")
  81.      *
  82.      * @ORM\Id
  83.      *
  84.      * @ORM\GeneratedValue(strategy="AUTO")
  85.      *
  86.      * @Serializer\Groups({
  87.      *     "Default", "List", "listingDetails", "listingDetailsWithLocationCompound", "Details", "Activity",
  88.      *     "DataLayer", "ActivitiesData", "DefaultV4", "MyListing", "MyListings", "SearchV4", "ProjectSearchV4",
  89.      *     "ProjectDetailsV4", "UnitDetails", "Autocomplete", "RelatedListingsV2", "SlugResolver", "locationListingV2",
  90.      *     "homeCompoundV2", "MyLeads"
  91.      * })
  92.      *
  93.      * @Serializer\Expose
  94.      */
  95.     private $id;
  96.     /**
  97.      * @ORM\OneToMany(targetEntity="Listing", mappedBy="parent")
  98.      *
  99.      * @ORM\OrderBy({"area" = "ASC"})
  100.      *
  101.      * @Serializer\Groups({"List", "Details"})
  102.      *
  103.      * @Serializer\Expose
  104.      *
  105.      * @Serializer\Until("v2.1")
  106.      */
  107.     private $children;
  108.     /**
  109.      * @ORM\ManyToOne(targetEntity="Listing", inversedBy="children")
  110.      *
  111.      * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
  112.      *
  113.      * @Serializer\Groups({"List", "Details", "DataLayer", "UnitDetails"})
  114.      *
  115.      * @Serializer\Expose
  116.      *
  117.      * @Serializer\Until("v2.1")
  118.      *
  119.      * @Serializer\MaxDepth(1)
  120.      */
  121.     private $parent;
  122.     /**
  123.      * @ORM\OneToOne(targetEntity="Listing")
  124.      *
  125.      * @ORM\JoinColumn(name="relist_id", referencedColumnName="id")
  126.      */
  127.     private $relistParent;
  128.     /**
  129.      * @ORM\Column(name="title", type="string", length=128, nullable=true)
  130.      *
  131.      * @Gedmo\Translatable
  132.      *
  133.      * @Serializer\Groups({
  134.      *     "Default", "List", "Details", "listingDetails", "listingDetailsWithLocationCompound", "Activity", "Preview",
  135.      *     "DefaultV4", "MyListing", "MyListings", "SearchV4", "ProjectSearchV4", "ProjectDetailsV4", "Autocomplete",
  136.      *     "RelatedListingsV2", "SlugResolver","locationListingV2", "homeCompoundV2", "MyLeads"
  137.      * })
  138.      *
  139.      * @Serializer\Expose
  140.      *
  141.      * @Assert\NotBlank(message="listing.title_required", groups={"step2"})
  142.      */
  143.     private ?string $title null;
  144.     /**
  145.      * @ORM\Column(name="description", type="text", length=1024, nullable=true)
  146.      *
  147.      * @Gedmo\Translatable
  148.      *
  149.      * @Serializer\Groups({"List", "Details", "listingDetails", "Activity", "DefaultV4", "MyListing", "MyListings", "SearchV4", "ProjectDetailsV4"})
  150.      *
  151.      * @Serializer\Expose
  152.      *
  153.      * @Assert\NotBlank(message="listing.description_required", groups={"step2"})
  154.      */
  155.     private ?string $description null;
  156.     /**
  157.      * @ORM\ManyToOne(targetEntity="Section", inversedBy="listings")
  158.      *
  159.      * @ORM\JoinColumn(name="section_id", referencedColumnName="id")
  160.      *
  161.      * @Serializer\Groups({"MyListings", "List", "Details", "listingDetails", "DataLayer", "DefaultV4", "MyListing", "SearchV4"})
  162.      *
  163.      * @Serializer\Expose
  164.      *
  165.      * @Assert\NotBlank(groups={"API"})
  166.      */
  167.     protected $section;
  168.     /**
  169.      * @var int
  170.      *
  171.      * @ORM\Column(name="category", type="smallint", nullable=false)
  172.      *
  173.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  174.      *
  175.      * @Serializer\Expose
  176.      */
  177.     private $category;
  178.     /**
  179.      * @var int
  180.      *
  181.      * @ORM\Column(name="pending_photos_status", type="smallint", nullable=true)
  182.      */
  183.     private $pendingPhotosStatus;
  184.     /**
  185.      * @var int
  186.      *
  187.      * @ORM\Column(name="pending_payment_status", type="smallint", nullable=true)
  188.      */
  189.     private $pendingPaymentStatus;
  190.     /**
  191.      * @var int
  192.      *
  193.      * @ORM\Column(name="relist_status", type="smallint", nullable=true)
  194.      */
  195.     private $relistStatus;
  196.     /**
  197.      * @ORM\Column(name="seller_role", type="smallint", nullable=true)
  198.      *
  199.      * @Serializer\Expose
  200.      *
  201.      * @Serializer\Groups({"Details", "listingDetails"})
  202.      *
  203.      * @Serializer\Since("v2.1")
  204.      */
  205.     private ?int $sellerRole null;
  206.     private $sellerRoleLabel;
  207.     /**
  208.      * @var int
  209.      *
  210.      * @ORM\Column(name="area", type="integer", nullable=true)
  211.      *
  212.      * @Serializer\Groups({"List", "Details", "DefaultV4", "MyListing", "MyListings", "SearchV4", "UnitDetails", "RelatedListingsV2", "listingDetails"})
  213.      *
  214.      * @Serializer\Expose
  215.      *
  216.      * @Assert\NotBlank(message="listing.area_required", groups={"step2"})
  217.      *
  218.      * @Assert\GreaterThan(value = 1, message="listing.area_minimum", groups={"step2"})
  219.      */
  220.     private $area;
  221.     /**
  222.      * CAUTION: type-hint string to avoid unnecessary update on every fetch.
  223.      *
  224.      * @ORM\Column(name="price", type="bigint", nullable=true)
  225.      *
  226.      * @Serializer\Groups({"List", "Details", "listingDetails", "Activity", "Preview", "DefaultV4", "MyListing", "MyListings", "SearchV4", "UnitDetails", "RelatedListingsV2"})
  227.      *
  228.      * @Serializer\Expose
  229.      *
  230.      * @Assert\NotBlank(message="listing.price_required", groups={"step2"})
  231.      *
  232.      * @Assert\GreaterThan(value = 100, message="listing.price_minimum", groups={"step2"})
  233.      */
  234.     private ?string $price null;
  235.     /**
  236.      * @var string
  237.      *
  238.      * @ORM\Column(name="address", type="text", length=512, nullable=true)
  239.      *
  240.      * @Gedmo\Translatable
  241.      *
  242.      * @Serializer\Groups({"List", "Details", "listingDetails", "Activity", "Preview", "DefaultV4", "SearchV4", "RelatedListingsV2", "locationListingV2", "homeCompoundV2", "MyListings"})
  243.      *
  244.      * @Serializer\Expose
  245.      *
  246.      * @Assert\Length(max=100)
  247.      *
  248.      * @Assert\NotBlank(message="listing.address_required", groups={"step2"})
  249.      */
  250.     private $address;
  251.     /**
  252.      * @var float
  253.      *
  254.      * @ORM\Column(name="center_lat", type="float", nullable=true)
  255.      *
  256.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  257.      *
  258.      * @Serializer\Expose
  259.      */
  260.     private $centerLat;
  261.     /**
  262.      * @var float
  263.      *
  264.      * @ORM\Column(name="center_lng", type="float", nullable=true)
  265.      *
  266.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  267.      *
  268.      * @Serializer\Expose
  269.      */
  270.     private $centerLng;
  271.     /**
  272.      * @var int
  273.      *
  274.      * @ORM\Column(name="status", type="smallint", nullable=true)
  275.      *
  276.      * @Serializer\Groups({"List", "Details", "Activity", "listingDetails"})
  277.      *
  278.      * @Serializer\Expose
  279.      */
  280.     private $status;
  281.     private $statusLabel;
  282.     /**
  283.      * @var int
  284.      *
  285.      * @Serializer\Groups({"List", "Details", "listingDetails", "SearchV4"})
  286.      *
  287.      * @Serializer\Expose
  288.      *
  289.      * @ORM\Column(name="property_view", type="smallint", nullable=true)
  290.      */
  291.     private $propertyView;
  292.     private $propertyViewLabel;
  293.     /**
  294.      * @var int
  295.      *
  296.      * @Serializer\Groups({"List", "Details"})
  297.      *
  298.      * @Serializer\Expose
  299.      *
  300.      * @ORM\Column(name="payment_method", type="smallint", nullable=true)
  301.      */
  302.     private $paymentMethod;
  303.     private $paymentMethodLabel;
  304.     /**
  305.      * @var bool
  306.      *
  307.      * @ORM\Column(name="featured", type="smallint", nullable=true)
  308.      */
  309.     private $featured;
  310.     /**
  311.      * @var int
  312.      *
  313.      * @ORM\Column(name="views", type="integer", nullable=true)
  314.      *
  315.      * @Serializer\Groups({"Api", "MyListing"})
  316.      *
  317.      * @Serializer\Expose
  318.      */
  319.     private $views 0;
  320.     /**
  321.      * @var int
  322.      *
  323.      * @ORM\Column(name="phone_counter", type="integer", options={"default" = 0})
  324.      *
  325.      * @Serializer\Groups({"Api"})
  326.      *
  327.      * @Serializer\Expose
  328.      */
  329.     private $phoneCounter 0;
  330.     /**
  331.      * @var int
  332.      *
  333.      * @ORM\Column(name="messages_counter", type="integer", options={"default" = 0})
  334.      *
  335.      * @Serializer\Groups({"Api"})
  336.      *
  337.      * @Serializer\Expose
  338.      */
  339.     private $messagesCounter 0;
  340.     /**
  341.      * @var int
  342.      *
  343.      * @ORM\Column(name="leads_counter", type="integer", options={"default" = 0})
  344.      *
  345.      * @Serializer\Groups({"Api"})
  346.      *
  347.      * @Serializer\Expose
  348.      */
  349.     private $leadsCounter 0;
  350.     /**
  351.      * @var int
  352.      *
  353.      * @ORM\Column(name="sent_notifiers", type="integer", nullable=true)
  354.      */
  355.     private $sentNotifiers;
  356.     /**
  357.      * @var int
  358.      *
  359.      * @ORM\Column(name="relist_counter", type="integer", nullable=true)
  360.      */
  361.     private $relistCounter;
  362.     /**
  363.      * @var string
  364.      *
  365.      * @ORM\Column(name="ip", type="string", length=50, nullable=true)
  366.      */
  367.     private $ip;
  368.     /**
  369.      * @var string
  370.      *
  371.      * @ORM\Column(name="video_url", type="string", length=150, nullable=true)
  372.      *
  373.      * @AqarMapAssert\IsYoutubeUrlOrNull
  374.      *
  375.      * @Serializer\Groups({"List", "Details", "listingDetails", "Activity", "DefaultV4", "ProjectSearchV4", "ProjectDetailsV4"})
  376.      *
  377.      * @Serializer\Expose
  378.      */
  379.     private $videoUrl;
  380.     /**
  381.      * @ORM\Column(name="slug", length=128, nullable=true)
  382.      *
  383.      * @Serializer\Groups({"locationListingV2", "SearchV4", "listingDetails"})
  384.      *
  385.      * @Serializer\Expose
  386.      */
  387.     private $slug;
  388.     /**
  389.      * @ORM\Column(name="custom_slug", length=50, unique=true, nullable=true)
  390.      *
  391.      * @Serializer\Groups({"DataLayer"})
  392.      *
  393.      * @Serializer\Expose
  394.      */
  395.     private $customSlug;
  396.     /**
  397.      * @var int
  398.      *
  399.      * @ORM\Column(name="score", type="float", nullable=true)
  400.      */
  401.     private $score;
  402.     /**
  403.      * @ORM\Column(name="created_at", type="datetime", nullable=true)
  404.      *
  405.      * @Serializer\Groups({"MyListings"})
  406.      *
  407.      * @Serializer\Expose()
  408.      */
  409.     private $createdAt;
  410.     /**
  411.      * @var \DateTime
  412.      *
  413.      * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  414.      *
  415.      * @Serializer\Groups({"Details", "DefaultV4", "List", "SearchV4", "listingDetails"})
  416.      *
  417.      * @Serializer\Expose()
  418.      */
  419.     private $updatedAt;
  420.     /**
  421.      * @var \DateTime
  422.      *
  423.      * @ORM\Column(name="pending_status_created_at", type="datetime", nullable=true)
  424.      *
  425.      * @Serializer\Groups({"Details", "DefaultV4", "List","SearchV4"})
  426.      *
  427.      * @Serializer\Expose()
  428.      */
  429.     private $pendingStatusCreatedAt;
  430.     /**
  431.      * @var \DateTime
  432.      *
  433.      * @ORM\Column(name="published_at", type="datetime", nullable=true)
  434.      *
  435.      * @Serializer\Groups({"List", "Details", "DefaultV4", "SearchV4", "ProjectSearchV4", "ProjectDetailsV4", "MyListings"})
  436.      *
  437.      * @Serializer\Expose
  438.      *
  439.      * @Assert\Range(
  440.      *      max = "now",
  441.      *      maxMessage = "listing.date_not_allowed"
  442.      * )
  443.      */
  444.     private $publishedAt;
  445.     /**
  446.      * @var \DateTime;
  447.      */
  448.     private $aggregatedPublishedAt;
  449.     /**
  450.      * @var \DateTime
  451.      *
  452.      * @ORM\Column(name="expires_at", type="datetime", nullable=true)
  453.      *
  454.      * @Serializer\Groups({"DefaultV4", "MyListing", "MyListings"})
  455.      *
  456.      * @Serializer\Expose
  457.      */
  458.     private $expiresAt;
  459.     /**
  460.      * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
  461.      *
  462.      * @Serializer\Groups({"listingDetails"})
  463.      *
  464.      * @Serializer\Expose
  465.      */
  466.     private $deletedAt;
  467.     /**
  468.      * @ORM\Column(name="rejected_at", type="datetime", nullable=true)
  469.      */
  470.     private $rejectedAt;
  471.     /**
  472.      * @ORM\OrderBy({"averagePricePerMeter" = "DESC"})
  473.      *
  474.      * @ORM\OneToMany(targetEntity="CompoundAveragePrice", mappedBy="parentCompound", cascade={"all"})
  475.      **/
  476.     private $compoundAveragePrices;
  477.     /**
  478.      * @ORM\ManyToOne(targetEntity="PropertyType", inversedBy="listings")
  479.      *
  480.      * @ORM\JoinColumn(name="property_type_id", referencedColumnName="id")
  481.      *
  482.      * @Serializer\Groups({"MyListings", "List", "Details", "listingDetails", "Activity", "DefaultV4", "SearchV4", "MyLeads"})
  483.      *
  484.      * @Serializer\Expose
  485.      *
  486.      * @Assert\NotBlank(groups={"API"})
  487.      */
  488.     protected $propertyType;
  489.     /**
  490.      * @ORM\ManyToOne(targetEntity="Location", inversedBy="listings")
  491.      *
  492.      * @ORM\JoinColumn(name="location_id", referencedColumnName="id")
  493.      *
  494.      * @Serializer\Groups({"List", "Details", "listingDetails", "Activity", "DefaultV4", "SearchV4", "ProjectDetailsV4", "RelatedListingsV2"})
  495.      *
  496.      * @Serializer\Expose
  497.      */
  498.     protected $location;
  499.     /**
  500.      * @ORM\ManyToMany(targetEntity="Location")
  501.      *
  502.      * @ORM\JoinTable(
  503.      *      name="listings_locations",
  504.      *      joinColumns={@ORM\JoinColumn(name="listing_id", referencedColumnName="id")},
  505.      *      inverseJoinColumns={@ORM\JoinColumn(name="location_id", referencedColumnName="id")}
  506.      * )
  507.      **/
  508.     protected $locations;
  509.     /**
  510.      * @ORM\ManyToOne(targetEntity="CompoundLocation", inversedBy="listings")
  511.      *
  512.      * @ORM\JoinColumn(name="compound_location_id", referencedColumnName="id", nullable=true)
  513.      *
  514.      * @Serializer\Groups({"Default", "ProjectSearchV4"})
  515.      *
  516.      * @Serializer\Expose
  517.      **/
  518.     protected $compoundLocation;
  519.     /**
  520.      * @ORM\ManyToOne(targetEntity="\Aqarmap\Bundle\UserBundle\Entity\User", inversedBy="listings")
  521.      *
  522.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE", nullable=false)
  523.      *
  524.      * @Serializer\Groups({"List", "Details", "listingDetails", "DefaultV4", "MyListing", "SearchV4", "ProjectDetailsV4", "ProjectSearchV4", "RelatedListingsV2", "MyListings", "MyLeads"})
  525.      *
  526.      * @Serializer\Expose
  527.      */
  528.     protected $user;
  529.     /**
  530.      * @ORM\ManyToMany(targetEntity="\Aqarmap\Bundle\UserBundle\Entity\User", fetch="EXTRA_LAZY")
  531.      *
  532.      * @ORM\JoinTable(
  533.      *      name="listings_participants",
  534.      *      joinColumns={@ORM\JoinColumn(name="listing_id", referencedColumnName="id")},
  535.      *      inverseJoinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}
  536.      * )
  537.      **/
  538.     protected $participants;
  539.     /**
  540.      * @ORM\OneToMany(targetEntity="ListingAttribute", mappedBy="listing", cascade={"all"}, orphanRemoval=true)
  541.      *
  542.      * @Serializer\Groups({"List", "Details", "Preview", "listingDetails"})
  543.      *
  544.      * @Serializer\Expose
  545.      *
  546.      * @Assert\Valid
  547.      **/
  548.     protected $attributes;
  549.     /**
  550.      * @ORM\OneToMany(
  551.      *     targetEntity="ListingPhone",
  552.      *     mappedBy="listing",
  553.      *     cascade={"all"},
  554.      *     orphanRemoval=true
  555.      *     )
  556.      *
  557.      * @Assert\Valid
  558.      **/
  559.     protected $phones;
  560.     /**
  561.      * @ORM\OneToMany(targetEntity="ListingPhoto", mappedBy="listing", cascade={"persist", "remove"}, orphanRemoval=true)
  562.      **/
  563.     protected $photos;
  564.     /**
  565.      * @ORM\OneToMany(
  566.      *   targetEntity="ListingTranslation",
  567.      *   mappedBy="object",
  568.      *   cascade={"all"},
  569.      *   orphanRemoval=true
  570.      * )
  571.      */
  572.     private $translations;
  573.     /**
  574.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\ListingLead", mappedBy="listing", fetch="EXTRA_LAZY")
  575.      **/
  576.     protected $leads;
  577.     /**
  578.      * @ORM\OneToMany(targetEntity="ListingFeature", mappedBy="listing")
  579.      **/
  580.     protected $listingFeatures;
  581.     /**
  582.      * @ORM\OneToMany(targetEntity="ListingNotification", mappedBy="listing")
  583.      **/
  584.     protected $ListingNotifications;
  585.     /**
  586.      * @ORM\ManyToMany(targetEntity="Rejection")
  587.      *
  588.      * @ORM\JoinTable(name="listings_rejections",
  589.      *      joinColumns={@ORM\JoinColumn(name="listing_id", referencedColumnName="id")},
  590.      *      inverseJoinColumns={@ORM\JoinColumn(name="rejection_id", referencedColumnName="id")}
  591.      *      )
  592.      *
  593.      * @Serializer\Groups({"userListing"})
  594.      *
  595.      * @Serializer\Expose
  596.      *
  597.      **/
  598.     protected $rejections;
  599.     /**
  600.      * @var string
  601.      *
  602.      * @ORM\Column(name="campaign", type="string", length=50, nullable=true)
  603.      *
  604.      * @Serializer\Groups({"List", "Details", "DefaultV4", "MyListing"})
  605.      *
  606.      * @Serializer\Expose
  607.      */
  608.     private $campaign;
  609.     /**
  610.      * @var int
  611.      *
  612.      * @ORM\Column(name="final_price", type="integer", nullable=true)
  613.      */
  614.     private $finalPrice;
  615.     /**
  616.      * @var string
  617.      *
  618.      * @ORM\Column(name="source_of_sale", type="string", nullable=true)
  619.      */
  620.     private $sourceOfSale;
  621.     /**
  622.      * @var string
  623.      *
  624.      * @ORM\Column(name="delete_reason", type="string", length=100, nullable=true)
  625.      */
  626.     private $deleteReason;
  627.     /**
  628.      * @var string
  629.      *
  630.      * @ORM\Column(name="delete_reason_details", type="text", nullable=true)
  631.      */
  632.     private $deleteReasonDetails;
  633.     /**
  634.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\Interaction",mappedBy="listing")
  635.      */
  636.     private $interactions;
  637.     /**
  638.      * @var string
  639.      */
  640.     private $userLogo;
  641.     /**
  642.      * @var string
  643.      */
  644.     private $listingLogo;
  645.     /**
  646.      * @Gedmo\Locale()
  647.      */
  648.     private $locale;
  649.     /**
  650.      * @ORM\Column(name="source",type="string",nullable=true)
  651.      */
  652.     private $source;
  653.     private $elasticSearchScore;
  654.     /**
  655.      * @var float
  656.      */
  657.     private $qualityScore;
  658.     /**
  659.      * @ORM\Column(name="impressions", type="integer", options={"default" = 0})
  660.      *
  661.      * @Serializer\SerializedName("impressions_count")
  662.      *
  663.      * @Serializer\Groups({"List", "Details", "MyListing", "MyListings"})
  664.      *
  665.      * @Serializer\Expose
  666.      */
  667.     private int $impressions 0;
  668.     /**
  669.      * @ORM\Column(name="impressions_monthly_count", type="integer", options={"default" = 0})
  670.      *
  671.      * @Serializer\SerializedName("impressions_monthly_count")
  672.      *
  673.      * @Serializer\Groups({"List", "Details"})
  674.      *
  675.      * @Serializer\Expose
  676.      */
  677.     private int $impressionsMonthlyCount 0;
  678.     /**
  679.      * @ORM\Column(name="impressions_weekly_count", type="integer", options={"default" = 0})
  680.      *
  681.      * @Serializer\SerializedName("impressions_weekly_count")
  682.      *
  683.      * @Serializer\Groups({"List", "Details"})
  684.      *
  685.      * @Serializer\Expose
  686.      */
  687.     private int $impressionsWeeklyCount 0;
  688.     /**
  689.      * @var \DateTime
  690.      *
  691.      * @ORM\Column(name="impression_updated_at", type="datetime", nullable=true)
  692.      */
  693.     private $impressionUpdatedAt;
  694.     /**
  695.      * @ORM\Column(name="price_level", type="smallint", nullable=true)
  696.      *
  697.      * @Serializer\Expose
  698.      */
  699.     private $priceLevel;
  700.     /**
  701.      * @var string
  702.      */
  703.     private $priceLevelLabel;
  704.     /**
  705.      * @ORM\Column(name="compound_status", type="smallint", nullable=true)
  706.      *
  707.      * @Serializer\Expose
  708.      */
  709.     private $compoundStatus;
  710.     /**
  711.      * @var string
  712.      */
  713.     private $compoundStatusLabel;
  714.     /**
  715.      * @ORM\Column(name="price_per_meter", type="float", nullable=true)
  716.      *
  717.      * @Serializer\Expose
  718.      *
  719.      * @Serializer\Groups({"listingDetails"})
  720.      */
  721.     private $pricePerMeter;
  722.     /**
  723.      * @ORM\Column(name="is_bumped", type="boolean", nullable=true)
  724.      */
  725.     private ?bool $isBumped false;
  726.     /**
  727.      * @ORM\Column(name="is_send_email", type="boolean", options={"default" = 1})
  728.      *
  729.      * @Serializer\Expose()
  730.      *
  731.      * @Serializer\Groups({"DefaultV4", "SearchV4", "RelatedListingsV2"})
  732.      */
  733.     private $isSendEmail true;
  734.     /**
  735.      * @ORM\Column(name="market_property_type", type="smallint", nullable=true)
  736.      *
  737.      * @Serializer\Groups({"DefaultV4","SearchV4","Details"})
  738.      *
  739.      * @Serializer\Expose
  740.      */
  741.     private ?int $marketPropertyType null;
  742.     /**
  743.      * @var int
  744.      *
  745.      * @ORM\Column(name="creation_source", type="smallint", nullable=true)
  746.      */
  747.     private $creationSource;
  748.     /**
  749.      * @deprecated
  750.      *
  751.      * @var int
  752.      *
  753.      * @ORM\Column(name="click_through_rate", type="float", options={"default" = 0})
  754.      */
  755.     private $clickThroughRate 0;
  756.     /**
  757.      * @var int
  758.      *
  759.      * @ORM\Column(name="label", type="smallint", nullable=true)
  760.      */
  761.     private $label;
  762.     /**
  763.      * @ORM\Column(name="is_top_picks", type="boolean", options={"default" = 0})
  764.      */
  765.     private $isTopPicks false;
  766.     /**
  767.      * @var int
  768.      *
  769.      * @ORM\Column(name="contact_rate", type="float", options={"default" = 0})
  770.      */
  771.     private $contactRate 0;
  772.     /**
  773.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\ListingRate", mappedBy="listing", fetch="EXTRA_LAZY")
  774.      */
  775.     private $rates;
  776.     /**
  777.      * @var int
  778.      */
  779.     private $totalRates;
  780.     /**
  781.      * @var ArrayCollection
  782.      */
  783.     private $rateReasonsCollection;
  784.     /**
  785.      * @ORM\Column(name="synced", type="boolean")
  786.      */
  787.     private $synced false;
  788.     /**
  789.      * @ORM\Column(name="reference_id", type="integer", nullable=true)
  790.      */
  791.     private $referenceId;
  792.     private $featuredTypeLabel;
  793.     /**
  794.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\Favourite", mappedBy="listing")
  795.      */
  796.     protected $favourite;
  797.     /**
  798.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ValueEngineBundle\Entity\ValueEngineListingsLocations", mappedBy="listing")
  799.      **/
  800.     protected $valueEngineListingsLocations;
  801.     /**
  802.      * @ORM\Column(name="is_pending_featuring", type="boolean", nullable=true)
  803.      */
  804.     private $isPendingFeaturing false;
  805.     /**
  806.      * @ORM\Column(name="pending_featuring_type", type="integer", nullable=true)
  807.      */
  808.     private $pendingFeaturingType;
  809.     /**
  810.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\ListingNote", mappedBy="listing")
  811.      */
  812.     protected $notes;
  813.     /**
  814.      * @var bool
  815.      */
  816.     private $isFavourite false;
  817.     /**
  818.      * @var string
  819.      */
  820.     private $userNote;
  821.     /**
  822.      * @ORM\Column(name="rate_status", type="smallint", nullable=true)
  823.      */
  824.     private $rateStatus;
  825.     /**
  826.      * @ORM\Column(name="is_rate_reviewed", type="boolean", nullable=true, options={"default" = 0})
  827.      */
  828.     private $isRateReviewed false;
  829.     /**
  830.      * @ORM\Column(name="is_call_request", type="boolean", options={"default" = 0})
  831.      *
  832.      * @Serializer\SerializedName("isCallRequest")
  833.      *
  834.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4","ProjectDetailsV4", "RelatedListingsV2", "listingDetails"})
  835.      *
  836.      * @Serializer\Expose
  837.      */
  838.     private $isCallRequest false;
  839.     /**
  840.      * @ORM\Column(name="is_shown_in_homepage", type="boolean", options={"default" = 0})
  841.      *
  842.      * @Serializer\Groups({"List", "Details", "DefaultV4"})
  843.      *
  844.      * @Serializer\Expose
  845.      */
  846.     private $isShownInHomepage false;
  847.     /**
  848.      * @var DateTime
  849.      */
  850.     private $reportedDate;
  851.     /**
  852.      * @var Listing
  853.      */
  854.     private $parentOfSimilarListing;
  855.     /**
  856.      * @Serializer\SerializedName("attributes")
  857.      *
  858.      * @Serializer\Groups({"NotesDetails"})
  859.      *
  860.      * @Serializer\Expose()
  861.      */
  862.     private $listingAttributes = [];
  863.     /**
  864.      * TODO:This Field Is maily Related To Compounds Will Be removed with new project compounds Valu.
  865.      *
  866.      * @var int
  867.      *
  868.      * @ORM\Column(name="is_commercial", type="smallint", nullable=true)
  869.      */
  870.     private $isCommercial false;
  871.     /**
  872.      * @var array
  873.      */
  874.     private $mappedPhotos = [];
  875.     /**
  876.      * @var array
  877.      */
  878.     private $v4Translations = [];
  879.     private ?array $mappedMainPhoto null;
  880.     /**
  881.      * @var bool
  882.      *
  883.      * @ORM\Column(name="is_resale", type="boolean", options={"default" = 0})
  884.      *
  885.      * @Serializer\SerializedName("isResale")
  886.      *
  887.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4", "ProjectDetailsV4"})
  888.      *
  889.      * @Serializer\Expose
  890.      */
  891.     private $isResale false;
  892.     /**
  893.      * @var bool
  894.      *
  895.      * @ORM\Column(name="is_rent", type="boolean", options={"default" = 0})
  896.      *
  897.      * @Serializer\SerializedName("isRent")
  898.      *
  899.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4", "ProjectDetailsV4"})
  900.      *
  901.      * @Serializer\Expose
  902.      */
  903.     private $isRent false;
  904.     /**
  905.      * @var bool
  906.      *
  907.      * @ORM\Column(name="is_primary", type="boolean", options={"default" = 0})
  908.      *
  909.      * @Serializer\SerializedName("isPrimary")
  910.      *
  911.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4", "ProjectDetailsV4"})
  912.      *
  913.      * @Serializer\Expose
  914.      */
  915.     private $isPrimary false;
  916.     /**
  917.      * @var bool
  918.      *
  919.      * @ORM\Column(name="is_mortgage_approved", type="boolean", nullable=true)
  920.      *
  921.      * @Serializer\SerializedName("isMortgageApproved")
  922.      *
  923.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4", "listingDetails"})
  924.      *
  925.      * @Serializer\Expose
  926.      */
  927.     private $isMortgageApproved;
  928.     /**
  929.      * @ORM\OneToMany(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\ListingsRatesNote", mappedBy="listing")
  930.      *
  931.      * @Serializer\Groups({"List", "Details"})
  932.      *
  933.      * @Serializer\Expose
  934.      */
  935.     private $ratesNotes = [];
  936.     /**
  937.      * @var string
  938.      *
  939.      * @ORM\Column(name="meta_title", type="string", length=128, nullable=true)
  940.      *
  941.      * @Gedmo\Translatable
  942.      */
  943.     private $metaTitle;
  944.     /**
  945.      * @var string
  946.      *
  947.      * @ORM\Column(name="meta_description", type="text", length=1024, nullable=true)
  948.      *
  949.      * @Gedmo\Translatable
  950.      */
  951.     private $metaDescription;
  952.     /**
  953.      * @var bool
  954.      *
  955.      * @ORM\Column(name="is_mortgage", type="boolean", options={"default" = 0})
  956.      *
  957.      * @Serializer\SerializedName("isMortgage")
  958.      *
  959.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4", "RelatedListingsV2"})
  960.      *
  961.      * @Serializer\Expose
  962.      */
  963.     private $isMortgage false;
  964.     /**
  965.      * @var CompoundField
  966.      *
  967.      * @ORM\OneToOne(targetEntity="Aqarmap\Bundle\ListingBundle\Entity\CompoundField")
  968.      *
  969.      * @ORM\JoinColumn(name="compound_field_id", referencedColumnName="id")
  970.      */
  971.     protected $compoundField;
  972.     /** @var array
  973.      *
  974.      * @ORM\Column(name="eligible_for_mortgage", type="array", nullable=true)
  975.      */
  976.     private $eligibleForMortgage;
  977.     /**
  978.      * @var array
  979.      */
  980.     private $propertyRegistrationStatusOptions;
  981.     /**
  982.      * @var array
  983.      */
  984.     private $eligibleForMortgageData;
  985.     /**
  986.      * property Registration Status , default I'm not know = 4.
  987.      *
  988.      * @var int
  989.      *
  990.      * @ORM\Column(name="property_registration_status", type="integer", nullable=true ,options={"default" = 4})
  991.      *
  992.      * @Serializer\SerializedName("propertyRegistrationStatus")
  993.      *
  994.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4"})
  995.      *
  996.      * @Serializer\Expose
  997.      */
  998.     private $propertyRegistrationStatus;
  999.     /**
  1000.      * @var array
  1001.      *
  1002.      * @Serializer\SerializedName("propertyTypeChildren")
  1003.      *
  1004.      * @Serializer\Groups({"ProjectDetailsV4"})
  1005.      *
  1006.      * @Serializer\Expose
  1007.      */
  1008.     private $propertyTypeChilden = [];
  1009.     /**
  1010.      * @var float
  1011.      */
  1012.     private $compoundElasticScore;
  1013.     /**
  1014.      * @var FinancialAid
  1015.      */
  1016.     private $financialAid;
  1017.     /**
  1018.      * @deprecated It's bad design, and cause a performance issues
  1019.      */
  1020.     private int $similarListingsCount 0;
  1021.     /**
  1022.      * @deprecated It's bad design, and cause a performance issues
  1023.      */
  1024.     private array $similarListingsIds = [];
  1025.     /**
  1026.      * @var string|null
  1027.      *
  1028.      * @ORM\Column(name="advertiser_number", type="string", nullable=true)
  1029.      *
  1030.      * @Serializer\SerializedName("advertiserNumber")
  1031.      *
  1032.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4"})
  1033.      *
  1034.      * @Serializer\Expose
  1035.      */
  1036.     private $advertiserNumber;
  1037.     /**
  1038.      * @var string|null
  1039.      *
  1040.      * @ORM\Column(name="authorization_number", type="string", nullable=true)
  1041.      *
  1042.      * @Serializer\SerializedName("authorizationNumber")
  1043.      *
  1044.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4"})
  1045.      *
  1046.      * @Serializer\Expose
  1047.      */
  1048.     private $authorizationNumber;
  1049.     /**
  1050.      * @var float
  1051.      */
  1052.     private $costPerLead 0;
  1053.     /**
  1054.      * @Serializer\Groups({"ProjectDetailsV4"})
  1055.      *
  1056.      * @Serializer\SerializedName("resaleCount")
  1057.      *
  1058.      * @Serializer\Expose
  1059.      */
  1060.     private $resaleCount 0;
  1061.     /**
  1062.      * @Serializer\Groups({ "ProjectDetailsV4"})
  1063.      *
  1064.      * @Serializer\SerializedName("rentCount")
  1065.      *
  1066.      * @Serializer\Expose
  1067.      */
  1068.     private $rentCount 0;
  1069.     /**
  1070.      * @var \DateTime
  1071.      *
  1072.      * @ORM\Column(name="freezed_at", type="datetime", nullable=true)
  1073.      */
  1074.     private $freezedAt;
  1075.     /**
  1076.      * @ORM\Column(name="eligible_for_bumpup", type="boolean", options={"default" = 0})
  1077.      */
  1078.     private $eligibleForBumpUp false;
  1079.     /**
  1080.      * @ORM\Column(name="waiting_time", type="string", length=50, nullable=true)
  1081.      *
  1082.      * @var string
  1083.      */
  1084.     private $waitingTime;
  1085.     /**
  1086.      * @ORM\Column(name="reference_number", type="string", length=128, nullable=true)
  1087.      *
  1088.      * @Serializer\Groups({"Default", "MyListing", "MyListings", "listingDetails", "MyLeads"})
  1089.      *
  1090.      * @Serializer\Expose
  1091.      */
  1092.     private ?string $referenceNumber null;
  1093.     /**
  1094.      * Constructor.
  1095.      */
  1096.     public function __construct()
  1097.     {
  1098.         $this->children = new ArrayCollection();
  1099.         $this->attributes = new ArrayCollection();
  1100.         $this->phones = new ArrayCollection();
  1101.         $this->photos = new ArrayCollection();
  1102.         $this->leads = new ArrayCollection();
  1103.         $this->rates = new ArrayCollection();
  1104.         $this->listingFeatures = new ArrayCollection();
  1105.         $this->ListingNotifications = new ArrayCollection();
  1106.         $this->translations = new ArrayCollection();
  1107.         $this->rejections = new ArrayCollection();
  1108.         $this->participants = new ArrayCollection();
  1109.         $this->rateReasonsCollection = new ArrayCollection();
  1110.         $this->favourite = new ArrayCollection();
  1111.     }
  1112.     /**
  1113.      * Clone.
  1114.      */
  1115.     public function __clone()
  1116.     {
  1117.         $this->id null;
  1118.         $this->slug null;
  1119.         $this->children null;
  1120.         $this->title null;
  1121.         $this->address null;
  1122.         $this->description null;
  1123.         $this->translations null;
  1124.         $this->leads = new ArrayCollection();
  1125.         $this->participants null;
  1126.         $this->featured 0;
  1127.         $this->views 0;
  1128.         $this->customSlug null;
  1129.         $this->relistCounter 0;
  1130.         $this->messagesCounter 0;
  1131.         $this->phoneCounter 0;
  1132.         $this->sentNotifiers 0;
  1133.         $this->isBumped false;
  1134.         $this->ratesNotes = new ArrayCollection();
  1135.         $this->compoundField null;
  1136.         $this->compoundAveragePrices null;
  1137.     }
  1138.     /**
  1139.      * @ORM\PrePersist
  1140.      */
  1141.     public function onPrePersist(): void
  1142.     {
  1143.         if (!$this->getCreatedAt()) {
  1144.             $this->setCreatedAt(new \DateTime());
  1145.         }
  1146.         if (!$this->getUpdatedAt()) {
  1147.             $this->setUpdatedAt(new \DateTime());
  1148.         }
  1149.     }
  1150.     /**
  1151.      * Get id.
  1152.      *
  1153.      * @return int
  1154.      */
  1155.     public function getId()
  1156.     {
  1157.         return $this->id;
  1158.     }
  1159.     /**
  1160.      * Set title.
  1161.      *
  1162.      * @param string $title
  1163.      *
  1164.      * @return Listing
  1165.      */
  1166.     public function setTitle($title)
  1167.     {
  1168.         $this->title $title;
  1169.         return $this;
  1170.     }
  1171.     /**
  1172.      * Get title.
  1173.      *
  1174.      * @return string
  1175.      */
  1176.     public function getTitle()
  1177.     {
  1178.         return $this->title;
  1179.     }
  1180.     /**
  1181.      * Set description.
  1182.      *
  1183.      * @param string $description
  1184.      *
  1185.      * @return Listing
  1186.      */
  1187.     public function setDescription($description)
  1188.     {
  1189.         $this->description $description;
  1190.         return $this;
  1191.     }
  1192.     /**
  1193.      * Get description.
  1194.      *
  1195.      * @return string
  1196.      */
  1197.     public function getDescription()
  1198.     {
  1199.         return $this->description;
  1200.     }
  1201.     /**
  1202.      * Set section.
  1203.      *
  1204.      * @return Listing
  1205.      */
  1206.     public function setSection(?Section $section null)
  1207.     {
  1208.         $this->section $section;
  1209.         return $this;
  1210.     }
  1211.     /**
  1212.      * Get section.
  1213.      *
  1214.      * @return Section
  1215.      */
  1216.     public function getSection()
  1217.     {
  1218.         return $this->section;
  1219.     }
  1220.     /**
  1221.      * Set category.
  1222.      *
  1223.      * @param int $category
  1224.      *
  1225.      * @return Listing
  1226.      */
  1227.     public function setCategory($category)
  1228.     {
  1229.         $this->category $category;
  1230.         return $this;
  1231.     }
  1232.     /**
  1233.      * Get category.
  1234.      *
  1235.      * @return int
  1236.      */
  1237.     public function getCategory()
  1238.     {
  1239.         return $this->category;
  1240.     }
  1241.     /**
  1242.      * Get category name.
  1243.      *
  1244.      * @return string
  1245.      */
  1246.     public function getCategoryName()
  1247.     {
  1248.         return ListingCategories::getLabel($this->category);
  1249.     }
  1250.     /**
  1251.      * @return bool
  1252.      */
  1253.     public function isDraft()
  1254.     {
  1255.         return ListingStatus::DRAFT == $this->status;
  1256.     }
  1257.     /**
  1258.      * @return bool
  1259.      */
  1260.     public function isLive()
  1261.     {
  1262.         return ListingStatus::LIVE == $this->status;
  1263.     }
  1264.     /**
  1265.      * Set pendingPhotosStatus.
  1266.      *
  1267.      * @param int $pendingPhotosStatus
  1268.      *
  1269.      * @return Listing
  1270.      */
  1271.     public function setPendingPhotosStatus($pendingPhotosStatus)
  1272.     {
  1273.         $this->pendingPhotosStatus $pendingPhotosStatus;
  1274.         return $this;
  1275.     }
  1276.     /**
  1277.      * Get pendingPhotosStatus.
  1278.      *
  1279.      * @return int
  1280.      */
  1281.     public function getPendingPhotosStatus()
  1282.     {
  1283.         return $this->pendingPhotosStatus;
  1284.     }
  1285.     /**
  1286.      * Set pendingPaymentStatus.
  1287.      *
  1288.      * @param int $pendingPaymentStatus
  1289.      *
  1290.      * @return Listing
  1291.      */
  1292.     public function setPendingPaymentStatus($pendingPaymentStatus)
  1293.     {
  1294.         $this->pendingPaymentStatus $pendingPaymentStatus;
  1295.         return $this;
  1296.     }
  1297.     /**
  1298.      * Get pendingPaymentStatus.
  1299.      *
  1300.      * @return int
  1301.      */
  1302.     public function getPendingPaymentStatus()
  1303.     {
  1304.         return $this->pendingPaymentStatus;
  1305.     }
  1306.     /**
  1307.      * Set relistStatus.
  1308.      *
  1309.      * @param int $relistStatus
  1310.      *
  1311.      * @return Listing
  1312.      */
  1313.     public function setRelistStatus($relistStatus)
  1314.     {
  1315.         $this->relistStatus $relistStatus;
  1316.         return $this;
  1317.     }
  1318.     /**
  1319.      * Get relistStatus.
  1320.      *
  1321.      * @return int
  1322.      */
  1323.     public function getRelistStatus()
  1324.     {
  1325.         return $this->relistStatus;
  1326.     }
  1327.     /**
  1328.      * Set sellerRole.
  1329.      */
  1330.     public function setSellerRole(?int $sellerRole): self
  1331.     {
  1332.         $this->sellerRole $sellerRole;
  1333.         return $this;
  1334.     }
  1335.     /**
  1336.      * Get sellerRole.
  1337.      */
  1338.     public function getSellerRole(): ?int
  1339.     {
  1340.         return $this->sellerRole;
  1341.     }
  1342.     /**
  1343.      * @Serializer\VirtualProperty
  1344.      *
  1345.      * @Serializer\SerializedName("seller_role")
  1346.      *
  1347.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  1348.      *
  1349.      * @Serializer\Until("v2.0")
  1350.      *
  1351.      * @return string
  1352.      */
  1353.     public function getSellerRoleLabel()
  1354.     {
  1355.         return ListingSellerRoles::getLabel($this->getSellerRole());
  1356.     }
  1357.     public function setSellerRoleLabel($label): void
  1358.     {
  1359.         $this->sellerRoleLabel $label;
  1360.     }
  1361.     /**
  1362.      * @Serializer\VirtualProperty
  1363.      *
  1364.      * @Serializer\SerializedName("seller_role_label")
  1365.      *
  1366.      * @Serializer\Groups({"List", "Details"})
  1367.      *
  1368.      * @Serializer\Since("v2.1")
  1369.      *
  1370.      * @Serializer\Until("v2.11")
  1371.      *
  1372.      * @return string
  1373.      */
  1374.     public function getSellerRoleAsLabel()
  1375.     {
  1376.         return self::getSellerRoleLabel();
  1377.     }
  1378.     /**
  1379.      * @Serializer\VirtualProperty
  1380.      *
  1381.      * @Serializer\SerializedName("seller_role_label")
  1382.      *
  1383.      * @Serializer\Groups({"List", "Details", "DefaultV4"})
  1384.      *
  1385.      * @Serializer\Since("v2.12")
  1386.      *
  1387.      * @return string
  1388.      */
  1389.     public function getSellerRoleTranslated()
  1390.     {
  1391.         return $this->sellerRoleLabel;
  1392.     }
  1393.     /**
  1394.      * @Serializer\VirtualProperty
  1395.      *
  1396.      * @Serializer\SerializedName("accepts_messages")
  1397.      *
  1398.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  1399.      *
  1400.      * @return bool
  1401.      */
  1402.     public function isAcceptsMessages()
  1403.     {
  1404.         return !$this->getUser()->hasRole('ROLE_TROOP');
  1405.     }
  1406.     /**
  1407.      * Set area.
  1408.      *
  1409.      * @param int $area
  1410.      *
  1411.      * @return Listing
  1412.      */
  1413.     public function setArea($area)
  1414.     {
  1415.         $this->area $area;
  1416.         return $this;
  1417.     }
  1418.     /**
  1419.      * Get area.
  1420.      *
  1421.      * @return int
  1422.      */
  1423.     public function getArea()
  1424.     {
  1425.         return (int) $this->area;
  1426.     }
  1427.     /**
  1428.      * Set price.
  1429.      *
  1430.      * @return Listing
  1431.      */
  1432.     public function setPrice(?int $price)
  1433.     {
  1434.         $this->price $price;
  1435.         return $this;
  1436.     }
  1437.     /**
  1438.      * Get price.
  1439.      */
  1440.     public function getPrice(): ?int
  1441.     {
  1442.         return $this->price;
  1443.     }
  1444.     /**
  1445.      * Set address.
  1446.      *
  1447.      * @param string $address
  1448.      *
  1449.      * @return Listing
  1450.      */
  1451.     public function setAddress($address)
  1452.     {
  1453.         $this->address $address;
  1454.         return $this;
  1455.     }
  1456.     /**
  1457.      * Get address.
  1458.      *
  1459.      * @return string
  1460.      */
  1461.     public function getAddress()
  1462.     {
  1463.         return $this->address;
  1464.     }
  1465.     /**
  1466.      * Set centerLat.
  1467.      *
  1468.      * @param float $centerLat
  1469.      *
  1470.      * @return Listing
  1471.      */
  1472.     public function setCenterLat($centerLat)
  1473.     {
  1474.         $this->centerLat $centerLat;
  1475.         return $this;
  1476.     }
  1477.     /**
  1478.      * Get centerLat.
  1479.      *
  1480.      * @return float
  1481.      */
  1482.     public function getCenterLat()
  1483.     {
  1484.         return $this->centerLat;
  1485.     }
  1486.     /**
  1487.      * Set centerLng.
  1488.      *
  1489.      * @param float $centerLng
  1490.      *
  1491.      * @return Listing
  1492.      */
  1493.     public function setCenterLng($centerLng)
  1494.     {
  1495.         $this->centerLng $centerLng;
  1496.         return $this;
  1497.     }
  1498.     /**
  1499.      * Get centerLng.
  1500.      *
  1501.      * @return float
  1502.      */
  1503.     public function getCenterLng()
  1504.     {
  1505.         return $this->centerLng;
  1506.     }
  1507.     /**
  1508.      * Set featured.
  1509.      *
  1510.      * @param int $featured
  1511.      *
  1512.      * @return Listing
  1513.      */
  1514.     public function setFeatured($featured)
  1515.     {
  1516.         $this->featured $featured;
  1517.         return $this;
  1518.     }
  1519.     /**
  1520.      * Get featured.
  1521.      *
  1522.      * @return int
  1523.      */
  1524.     public function getFeatured()
  1525.     {
  1526.         return $this->featured;
  1527.     }
  1528.     /**
  1529.      * @Serializer\VirtualProperty
  1530.      *
  1531.      * @Serializer\SerializedName("is_featured")
  1532.      *
  1533.      * @Serializer\Groups({"List", "Details", "DataLayer", "MyListing", "MyListings", "listingDetails"})
  1534.      *
  1535.      * @return bool
  1536.      */
  1537.     public function isFeatured()
  1538.     {
  1539.         return (bool) $this->getFeatured();
  1540.     }
  1541.     /**
  1542.      * @Serializer\VirtualProperty
  1543.      *
  1544.      * @Serializer\SerializedName("isFeatured")
  1545.      *
  1546.      * @Serializer\Groups({"DefaultV4", "SearchV4"})
  1547.      *
  1548.      * @return bool
  1549.      */
  1550.     public function getFeaturingStatus()
  1551.     {
  1552.         return (bool) $this->getFeatured();
  1553.     }
  1554.     /**
  1555.      * @return string
  1556.      */
  1557.     public function getFeaturedLabel()
  1558.     {
  1559.         return ListingFeaturedTypes::getLabel($this->getFeatured());
  1560.     }
  1561.     /**
  1562.      * Set views.
  1563.      *
  1564.      * @param int $views
  1565.      *
  1566.      * @return Listing
  1567.      */
  1568.     public function setViews($views)
  1569.     {
  1570.         $this->views $views;
  1571.         return $this;
  1572.     }
  1573.     /**
  1574.      * Get views.
  1575.      *
  1576.      * @return int
  1577.      */
  1578.     public function getViews()
  1579.     {
  1580.         return $this->views $this->views 0;
  1581.     }
  1582.     /**
  1583.      * Get views count.
  1584.      *
  1585.      * @return int
  1586.      */
  1587.     public function getTotalViews()
  1588.     {
  1589.         $totalViews $this->getViews();
  1590.         if ($this->getChildren()) {
  1591.             foreach ($this->getChildren() as $listing) {
  1592.                 $totalViews += $listing->getViews();
  1593.             }
  1594.         }
  1595.         return $totalViews;
  1596.     }
  1597.     /**
  1598.      * Set relistCounter.
  1599.      *
  1600.      * @param int $relistCounter
  1601.      *
  1602.      * @return Listing
  1603.      */
  1604.     public function setRelistCounter($relistCounter)
  1605.     {
  1606.         $this->relistCounter $relistCounter;
  1607.         return $this;
  1608.     }
  1609.     /**
  1610.      * Get relistCounter.
  1611.      *
  1612.      * @return int
  1613.      */
  1614.     public function getRelistCounter()
  1615.     {
  1616.         return $this->relistCounter;
  1617.     }
  1618.     /**
  1619.      * Set sentNotifiers.
  1620.      *
  1621.      * @param int $sentNotifiers
  1622.      *
  1623.      * @return Listing
  1624.      */
  1625.     public function setSentNotifiers($sentNotifiers)
  1626.     {
  1627.         $this->sentNotifiers $sentNotifiers;
  1628.         return $this;
  1629.     }
  1630.     /**
  1631.      * Get sentNotifiers.
  1632.      *
  1633.      * @return int
  1634.      */
  1635.     public function getSentNotifiers()
  1636.     {
  1637.         return $this->sentNotifiers;
  1638.     }
  1639.     /**
  1640.      * Set status.
  1641.      *
  1642.      * @param int $status
  1643.      *
  1644.      * @return Listing
  1645.      */
  1646.     public function setStatus($status)
  1647.     {
  1648.         $this->status $status;
  1649.         return $this;
  1650.     }
  1651.     /**
  1652.      * Get status.
  1653.      *
  1654.      * @return int
  1655.      */
  1656.     public function getStatus()
  1657.     {
  1658.         return $this->status;
  1659.     }
  1660.     /**
  1661.      * @Serializer\VirtualProperty
  1662.      *
  1663.      * @Serializer\SerializedName("status_label")
  1664.      *
  1665.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  1666.      *
  1667.      * @Serializer\Until("v2.11")
  1668.      *
  1669.      * @return string
  1670.      */
  1671.     public function getStatusLabel()
  1672.     {
  1673.         return ListingStatus::getLabel($this->getStatus());
  1674.     }
  1675.     /**
  1676.      * @Serializer\VirtualProperty
  1677.      *
  1678.      * @Serializer\SerializedName("status_label")
  1679.      *
  1680.      * @Serializer\Groups({"List", "Details"})
  1681.      *
  1682.      * @Serializer\Since("v2.12")
  1683.      *
  1684.      * @return string
  1685.      */
  1686.     public function getStatusTranslated()
  1687.     {
  1688.         return $this->statusLabel;
  1689.     }
  1690.     public function setStatusLabel($label): void
  1691.     {
  1692.         $this->statusLabel $label;
  1693.     }
  1694.     /**
  1695.      * @return string
  1696.      */
  1697.     public function getStatusDescription()
  1698.     {
  1699.         return ListingStatus::getDescription($this->getStatus());
  1700.     }
  1701.     /**
  1702.      * Set ip.
  1703.      *
  1704.      * @param string $ip
  1705.      *
  1706.      * @return Listing
  1707.      */
  1708.     public function setIp($ip)
  1709.     {
  1710.         $this->ip $ip;
  1711.         return $this;
  1712.     }
  1713.     /**
  1714.      * Get ip.
  1715.      *
  1716.      * @return string
  1717.      */
  1718.     public function getIp()
  1719.     {
  1720.         return $this->ip;
  1721.     }
  1722.     /**
  1723.      * @param string $videoUrl
  1724.      *
  1725.      * @return $this
  1726.      */
  1727.     public function setVideoUrl($videoUrl)
  1728.     {
  1729.         $this->videoUrl $videoUrl;
  1730.         return $this;
  1731.     }
  1732.     /**
  1733.      * @return string
  1734.      */
  1735.     public function getVideoUrl()
  1736.     {
  1737.         return $this->videoUrl;
  1738.     }
  1739.     /**
  1740.      * Set slug.
  1741.      *
  1742.      * @param string $slug
  1743.      *
  1744.      * @return Listing
  1745.      */
  1746.     public function setSlug($slug)
  1747.     {
  1748.         $this->slug $slug;
  1749.         return $this;
  1750.     }
  1751.     /**
  1752.      * Get slug.
  1753.      *
  1754.      * @return string
  1755.      */
  1756.     public function getSlug()
  1757.     {
  1758.         return $this->slug;
  1759.     }
  1760.     /**
  1761.      * Set customSlug.
  1762.      *
  1763.      * @param string $customSlug
  1764.      *
  1765.      * @return Listing
  1766.      */
  1767.     public function setCustomSlug($customSlug)
  1768.     {
  1769.         $this->customSlug str_replace(' ''-'strtolower($customSlug));
  1770.         return $this;
  1771.     }
  1772.     /**
  1773.      * Get customSlug.
  1774.      *
  1775.      * @param bool $force
  1776.      *
  1777.      * @return string
  1778.      */
  1779.     public function getCustomSlug($force false)
  1780.     {
  1781.         if ($force && empty($this->customSlug)) {
  1782.             return $this->slug;
  1783.         }
  1784.         return $this->customSlug;
  1785.     }
  1786.     /**
  1787.      * Set score.
  1788.      *
  1789.      * @param float $score
  1790.      *
  1791.      * @return Listing
  1792.      */
  1793.     public function setScore($score)
  1794.     {
  1795.         $this->score $score;
  1796.         return $this;
  1797.     }
  1798.     /**
  1799.      * Get score.
  1800.      *
  1801.      * @return float
  1802.      */
  1803.     public function getScore()
  1804.     {
  1805.         return $this->score;
  1806.     }
  1807.     /**
  1808.      * Set maxPrice.
  1809.      *
  1810.      * @param int $maxPrice
  1811.      *
  1812.      * @return Listing
  1813.      */
  1814.     public function setMaxPrice($maxPrice)
  1815.     {
  1816.         $this->maxPrice $maxPrice;
  1817.         return $this;
  1818.     }
  1819.     /**
  1820.      * Get maxPrice.
  1821.      *
  1822.      * @return int
  1823.      */
  1824.     public function getMaxPrice()
  1825.     {
  1826.         return $this->maxPrice;
  1827.     }
  1828.     /**
  1829.      * Set createdAt.
  1830.      *
  1831.      * @param \DateTime $createdAt
  1832.      *
  1833.      * @return Listing
  1834.      */
  1835.     public function setCreatedAt($createdAt)
  1836.     {
  1837.         $this->createdAt $createdAt;
  1838.         return $this;
  1839.     }
  1840.     /**
  1841.      * Get createdAt.
  1842.      *
  1843.      * @Serializer\VirtualProperty()
  1844.      *
  1845.      * @Serializer\Groups({"MyListing"})
  1846.      *
  1847.      * @Serializer\Expose
  1848.      *
  1849.      * @return \DateTime
  1850.      */
  1851.     public function getCreatedAt()
  1852.     {
  1853.         return $this->createdAt;
  1854.     }
  1855.     /**
  1856.      * Set updatedAt.
  1857.      *
  1858.      * @param \DateTime $updatedAt
  1859.      *
  1860.      * @return Listing
  1861.      */
  1862.     public function setUpdatedAt($updatedAt)
  1863.     {
  1864.         $this->updatedAt $updatedAt;
  1865.         return $this;
  1866.     }
  1867.     /**
  1868.      * Get updatedAt.
  1869.      *
  1870.      * @return \DateTime
  1871.      */
  1872.     public function getUpdatedAt()
  1873.     {
  1874.         return $this->updatedAt;
  1875.     }
  1876.     /**
  1877.      * Set pendingStatusCreatedAt.
  1878.      *
  1879.      * @param \DateTime $pendingStatusCreatedAt
  1880.      *
  1881.      * @return Listing
  1882.      */
  1883.     public function setPendingStatusCreatedAt($pendingStatusCreatedAt)
  1884.     {
  1885.         $this->pendingStatusCreatedAt $pendingStatusCreatedAt;
  1886.         return $this;
  1887.     }
  1888.     /**
  1889.      * Get pendingStatusCreatedAt.
  1890.      *
  1891.      * @return \DateTime
  1892.      */
  1893.     public function getPendingStatusCreatedAt()
  1894.     {
  1895.         return $this->pendingStatusCreatedAt;
  1896.     }
  1897.     /**
  1898.      * Set publishedAt.
  1899.      *
  1900.      * @return Listing
  1901.      */
  1902.     public function setPublishedAt(?\DateTime $publishedAt null)
  1903.     {
  1904.         $this->publishedAt $publishedAt;
  1905.         return $this;
  1906.     }
  1907.     /**
  1908.      * Get publishedAt.
  1909.      *
  1910.      * @return \DateTime
  1911.      */
  1912.     public function getPublishedAt()
  1913.     {
  1914.         return $this->publishedAt;
  1915.     }
  1916.     /**
  1917.      * @Serializer\VirtualProperty()
  1918.      *
  1919.      * @return \DateTime|ArrayCollection|Collection
  1920.      */
  1921.     public function getAggregatedPublishedAt()
  1922.     {
  1923.         $lastBump $this->getLastAutoBumpUp();
  1924.         /** @var ListingFeature $lastFeature */
  1925.         $lastFeature $this->getLastListingFeature();
  1926.         $listingFeature null;
  1927.         if ($lastBump && $lastFeature) {
  1928.             $listingFeature = ($lastBump->getLastBumpedAt() > $lastFeature->getCreatedAt()) ? $lastBump $lastFeature;
  1929.         } elseif ($lastBump) {
  1930.             $listingFeature $lastBump;
  1931.         } elseif ($lastFeature) {
  1932.             $listingFeature $lastFeature;
  1933.         }
  1934.         if (!$listingFeature) {
  1935.             return $this->getPublishedAt();
  1936.         }
  1937.         return (ListingFeatures::BUMP_UP == $listingFeature->getType() && $listingFeature->getLastBumpedAt()) ?
  1938.             $listingFeature->getLastBumpedAt() : $listingFeature->getCreatedAt();
  1939.     }
  1940.     /**
  1941.      * Set expiresAt.
  1942.      *
  1943.      * @param \DateTime $expiresAt
  1944.      *
  1945.      * @return Listing
  1946.      */
  1947.     public function setExpiresAt($expiresAt)
  1948.     {
  1949.         $this->expiresAt $expiresAt;
  1950.         return $this;
  1951.     }
  1952.     /**
  1953.      * Get expiresAt.
  1954.      *
  1955.      * @return \DateTime
  1956.      */
  1957.     public function getExpiresAt()
  1958.     {
  1959.         return $this->expiresAt;
  1960.     }
  1961.     public function setDeletedAt(?\DateTime $deletedAt): Listing
  1962.     {
  1963.         $this->deletedAt $deletedAt;
  1964.         return $this;
  1965.     }
  1966.     /**
  1967.      * Get deletedAt.
  1968.      *
  1969.      * @return \DateTime
  1970.      */
  1971.     public function getDeletedAt()
  1972.     {
  1973.         return $this->deletedAt;
  1974.     }
  1975.     /**
  1976.      * Set rejectedAt.
  1977.      *
  1978.      * @param \DateTime $rejectedAt
  1979.      *
  1980.      * @return Listing
  1981.      */
  1982.     public function setRejectedAt($rejectedAt)
  1983.     {
  1984.         $this->rejectedAt $rejectedAt;
  1985.         return $this;
  1986.     }
  1987.     /**
  1988.      * Get rejectedAt.
  1989.      *
  1990.      * @return \DateTime
  1991.      */
  1992.     public function getRejectedAt()
  1993.     {
  1994.         return $this->rejectedAt;
  1995.     }
  1996.     /**
  1997.      * Add children.
  1998.      *
  1999.      * @return Listing
  2000.      */
  2001.     public function addChild(self $children)
  2002.     {
  2003.         $this->children[] = $children;
  2004.         return $this;
  2005.     }
  2006.     /**
  2007.      * Remove children.
  2008.      */
  2009.     public function removeChild(self $children): void
  2010.     {
  2011.         $this->children->removeElement($children);
  2012.     }
  2013.     /**
  2014.      * Get children.
  2015.      *
  2016.      * @return Collection
  2017.      */
  2018.     public function getChildren()
  2019.     {
  2020.         $criteria Criteria::create()
  2021.             ->orderBy(['id' => Criteria::ASC]);
  2022.         if (!$this->children) {
  2023.             return null;
  2024.         }
  2025.         return $this->children->matching($criteria);
  2026.     }
  2027.     /**
  2028.      * Get only live listing children (live units) and order by area.
  2029.      */
  2030.     public function getLiveChildren(?PropertyType $propertyType null)
  2031.     {
  2032.         $criteria Criteria::create()->where(Criteria::expr()->eq('status'ListingStatus::LIVE));
  2033.         if ($propertyType) {
  2034.             $criteria->where(Criteria::expr()->eq('propertyType'$propertyType));
  2035.         }
  2036.         $criteria->orderBy(['area' => Criteria::ASC]);
  2037.         if (empty($this->children)) {
  2038.             return null;
  2039.         }
  2040.         return $this->children->matching($criteria);
  2041.     }
  2042.     public function getLiveChildrenIDs()
  2043.     {
  2044.         $ids = [];
  2045.         foreach ($this->getLiveChildren() as $listing) {
  2046.             $ids[] = $listing->getId();
  2047.         }
  2048.         return $ids;
  2049.     }
  2050.     /**
  2051.      * Get only pending listing children (live units) and order by area.
  2052.      */
  2053.     public function getPendingChildren()
  2054.     {
  2055.         $criteria Criteria::create()
  2056.             ->where(Criteria::expr()->in('status'ListingStatus::$pendingStatusArray))
  2057.             ->orderBy(['area' => Criteria::ASC]);
  2058.         return $this->children->matching($criteria);
  2059.     }
  2060.     /**
  2061.      * Set parent.
  2062.      *
  2063.      * @return Listing
  2064.      */
  2065.     public function setParent(?self $parent null)
  2066.     {
  2067.         $this->parent $parent;
  2068.         return $this;
  2069.     }
  2070.     /**
  2071.      * Get parent.
  2072.      *
  2073.      * @return Listing
  2074.      */
  2075.     public function getParent()
  2076.     {
  2077.         return $this->parent;
  2078.     }
  2079.     /**
  2080.      * Get Relist Parent.
  2081.      *
  2082.      * @return Listing
  2083.      */
  2084.     public function getRelistParent()
  2085.     {
  2086.         return $this->relistParent;
  2087.     }
  2088.     public function setRelistParent(self $relistParent): void
  2089.     {
  2090.         $this->relistParent $relistParent;
  2091.     }
  2092.     /**
  2093.      * Set propertyType.
  2094.      *
  2095.      * @return Listing
  2096.      */
  2097.     public function setPropertyType(?PropertyType $propertyType null)
  2098.     {
  2099.         $this->propertyType $propertyType;
  2100.         return $this;
  2101.     }
  2102.     /**
  2103.      * Get propertyType.
  2104.      *
  2105.      * @return PropertyType
  2106.      */
  2107.     public function getPropertyType()
  2108.     {
  2109.         return $this->propertyType;
  2110.     }
  2111.     /**
  2112.      * Set location.
  2113.      *
  2114.      * @return Listing
  2115.      */
  2116.     public function setLocation(?Location $location null)
  2117.     {
  2118.         $this->location $location;
  2119.         return $this;
  2120.     }
  2121.     /**
  2122.      * Get location.
  2123.      *
  2124.      * @return Location
  2125.      */
  2126.     public function getLocation()
  2127.     {
  2128.         return $this->location;
  2129.     }
  2130.     /**
  2131.      * Add location.
  2132.      *
  2133.      * @return Listing
  2134.      */
  2135.     public function addLocation(Location $location)
  2136.     {
  2137.         $this->locations[] = $location;
  2138.         return $this;
  2139.     }
  2140.     /**
  2141.      * Has location.
  2142.      *
  2143.      * @return bool
  2144.      */
  2145.     public function hasLocation(Location $location)
  2146.     {
  2147.         return $this->locations->contains($location);
  2148.     }
  2149.     /**
  2150.      * Set Locations.
  2151.      *
  2152.      * @return Listing
  2153.      */
  2154.     public function setLocations($locations)
  2155.     {
  2156.         foreach ($locations as $location) {
  2157.             $this->addLocation($location);
  2158.         }
  2159.         return $this;
  2160.     }
  2161.     /**
  2162.      * Remove location.
  2163.      */
  2164.     public function removeLocation(Location $location): void
  2165.     {
  2166.         $this->locations->removeElement($location);
  2167.     }
  2168.     /**
  2169.      * Get locations.
  2170.      *
  2171.      * @return Collection
  2172.      */
  2173.     public function getLocations()
  2174.     {
  2175.         return $this->locations;
  2176.     }
  2177.     /**
  2178.      * @return $this
  2179.      */
  2180.     public function setCompoundLocation(?CompoundLocation $compoundLocation null)
  2181.     {
  2182.         $this->compoundLocation $compoundLocation;
  2183.         return $this;
  2184.     }
  2185.     /**
  2186.      * @return CompoundLocation
  2187.      */
  2188.     public function getCompoundLocation()
  2189.     {
  2190.         if (!$this->compoundLocation && $this->hasParent()) {
  2191.             return $this->getParent()->getCompoundLocation();
  2192.         }
  2193.         return $this->compoundLocation;
  2194.     }
  2195.     /**
  2196.      * @return mixed|string
  2197.      */
  2198.     public function getCompoundLocationTitle()
  2199.     {
  2200.         $compoundLocation $this->getCompoundLocation();
  2201.         if ($compoundLocation instanceof CompoundLocation) {
  2202.             return $compoundLocation->getTitle();
  2203.         }
  2204.         return '';
  2205.     }
  2206.     /**
  2207.      * Set user.
  2208.      *
  2209.      * @return Listing
  2210.      */
  2211.     public function setUser(?User $user null)
  2212.     {
  2213.         $this->user $user;
  2214.         return $this;
  2215.     }
  2216.     /**
  2217.      * Get user.
  2218.      *
  2219.      * @return User
  2220.      */
  2221.     public function getUser()
  2222.     {
  2223.         return $this->user;
  2224.     }
  2225.     /**
  2226.      * Add participants.
  2227.      *
  2228.      * @return Listing
  2229.      */
  2230.     public function addParticipant(User $participants)
  2231.     {
  2232.         $this->participants[] = $participants;
  2233.         return $this;
  2234.     }
  2235.     /**
  2236.      * Remove participants.
  2237.      */
  2238.     public function removeParticipant(User $participants): void
  2239.     {
  2240.         $this->participants->removeElement($participants);
  2241.     }
  2242.     /**
  2243.      * Get participants.
  2244.      *
  2245.      * @return Collection
  2246.      */
  2247.     public function getParticipants()
  2248.     {
  2249.         return $this->participants;
  2250.     }
  2251.     /**
  2252.      * Has participant.
  2253.      *
  2254.      * @return bool
  2255.      */
  2256.     public function hasParticipant(User $participant)
  2257.     {
  2258.         $participants $this->getParticipants();
  2259.         if (\is_object($participants)) {
  2260.             return $this->getParticipants()->contains($participant) ? true false;
  2261.         }
  2262.         return false;
  2263.     }
  2264.     /**
  2265.      * @return ArrayCollection
  2266.      */
  2267.     public function getAllParticipants()
  2268.     {
  2269.         $participants = new ArrayCollection();
  2270.         $participants->add($this->getUser());
  2271.         foreach ($this->getParticipants() as $participant) {
  2272.             if (!$participants->contains($participant)) {
  2273.                 $participants->add($participant);
  2274.             }
  2275.         }
  2276.         if ($this->getParent()) {
  2277.             foreach ($this->getParent()->getAllParticipants() as $participant) {
  2278.                 if (!$participants->contains($participant)) {
  2279.                     $participants->add($participant);
  2280.                 }
  2281.             }
  2282.         }
  2283.         return $participants;
  2284.     }
  2285.     /**
  2286.      * @return ArrayCollection
  2287.      */
  2288.     public function getAllLocations()
  2289.     {
  2290.         $locations = new ArrayCollection();
  2291.         $locations->add($this->getLocation());
  2292.         foreach ($this->getLocations() as $location) {
  2293.             if (!$locations->contains($location)) {
  2294.                 $locations->add($location);
  2295.             }
  2296.         }
  2297.         return $locations;
  2298.     }
  2299.     /**
  2300.      * @return array
  2301.      */
  2302.     public function getAllLocationsIDs()
  2303.     {
  2304.         $locations = new ArrayCollection();
  2305.         $locations->add($this->getLocation()->getId());
  2306.         foreach ($this->getLocations() as $location) {
  2307.             if (!$locations->contains($location->getId())) {
  2308.                 $locations->add($location->getId());
  2309.             }
  2310.         }
  2311.         return $locations->toArray();
  2312.     }
  2313.     /**
  2314.      * Add attribute.
  2315.      *
  2316.      * @return Listing
  2317.      */
  2318.     public function addAttribute(ListingAttribute $attribute)
  2319.     {
  2320.         if (!$attribute->isValid()) {
  2321.             return $this;
  2322.         }
  2323.         $attribute->setListing($this);
  2324.         $this->attributes[] = $attribute;
  2325.         return $this;
  2326.     }
  2327.     /**
  2328.      * Set attributes.
  2329.      *
  2330.      * @return Listing
  2331.      */
  2332.     public function setAttributes($attributes)
  2333.     {
  2334.         foreach ($attributes as $attribute) {
  2335.             if (
  2336.                 $attribute instanceof ListingAttribute
  2337.                 && !$attribute->isValid()
  2338.             ) {
  2339.                 continue;
  2340.             }
  2341.             $this->addAttribute($attribute);
  2342.         }
  2343.         return $this;
  2344.     }
  2345.     /**
  2346.      * Remove attribute.
  2347.      */
  2348.     public function removeAttribute(ListingAttribute $attribute): void
  2349.     {
  2350.         $this->attributes->removeElement($attribute);
  2351.     }
  2352.     /**
  2353.      * Clear attributes.
  2354.      */
  2355.     public function clearAttributes(): void
  2356.     {
  2357.         $this->attributes->clear();
  2358.     }
  2359.     /**
  2360.      * Get attributes.
  2361.      *
  2362.      * @return Collection
  2363.      */
  2364.     public function getAttributes()
  2365.     {
  2366.         return $this->attributes;
  2367.     }
  2368.     /**
  2369.      * Get Attributes in List.
  2370.      *
  2371.      * @return array
  2372.      */
  2373.     public function getAttributesList()
  2374.     {
  2375.         $attributeList = [];
  2376.         foreach ($this->attributes as $attribute) {
  2377.             $value $attribute->getValue();
  2378.             if (
  2379.                 PluralCustomFields::MAX_VALUE == $value
  2380.                 && \in_array($attribute->getCustomField()->getName(), PluralCustomFields::getChoices())
  2381.             ) {
  2382.                 $value PluralCustomFields::MAX_VALUE_LABEL;
  2383.             }
  2384.             $attributeList[$attribute->getCustomField()->getName()] = $value;
  2385.             if (ListingCustomFields::FINISH_TYPE_NAME == $attribute->getCustomField()->getName()) {
  2386.                 $attributeList[$attribute->getCustomField()->getName()] = $attribute->getValue();
  2387.             }
  2388.         }
  2389.         return $attributeList;
  2390.     }
  2391.     /**
  2392.      * Get attributes.
  2393.      *
  2394.      * @return Collection
  2395.      */
  2396.     public function getAttribute($attrName)
  2397.     {
  2398.         foreach ($this->attributes as $attribute) {
  2399.             if ($attrName == $attribute->getCustomField()->getName()) {
  2400.                 return $attribute;
  2401.             }
  2402.         }
  2403.     }
  2404.     /**
  2405.      * Add phones.
  2406.      *
  2407.      * @param ListingPhone $phone
  2408.      *
  2409.      * @return Listing
  2410.      */
  2411.     public function addPhone($phone)
  2412.     {
  2413.         $phone->setListing($this); // Synchronously updating inverse side
  2414.         $criteria Criteria::create()->where(Criteria::expr()->eq('number'$phone->getNumber()));
  2415.         if ($this->getPhones()->matching($criteria)->isEmpty()) {
  2416.             $this->phones[] = $phone;
  2417.         }
  2418.         return $this;
  2419.     }
  2420.     /**
  2421.      * Set Phones.
  2422.      *
  2423.      * @return Listing
  2424.      */
  2425.     public function setPhones($phones)
  2426.     {
  2427.         foreach ($phones as $phone) {
  2428.             $this->addPhone($phone);
  2429.         }
  2430.         return $this;
  2431.     }
  2432.     /**
  2433.      * Remove phone.
  2434.      */
  2435.     public function removePhone(ListingPhone $phone): void
  2436.     {
  2437.         $phone->setListing(null);
  2438.         $this->phones->removeElement($phone);
  2439.     }
  2440.     public function removePhones(): void
  2441.     {
  2442.         foreach ($this->phones as $phone) {
  2443.             $this->removePhone($phone);
  2444.         }
  2445.     }
  2446.     /**
  2447.      * Get phones.
  2448.      *
  2449.      * @Serializer\Groups({"List", "Details", "RelatedListingsV2", "listingDetails"})
  2450.      *
  2451.      * @Serializer\VirtualProperty
  2452.      *
  2453.      * @Serializer\Expose
  2454.      *
  2455.      * @return ArrayCollection
  2456.      */
  2457.     public function getPhones()
  2458.     {
  2459.         return $this->listMainListingPhonesFromUser();
  2460.     }
  2461.     /**
  2462.      * Get Mapped Phones For V4.
  2463.      *
  2464.      * @Serializer\Groups({"DefaultV4", "SearchV4", "ProjectDetailsV4", "ProjectSearchV4","locationListingV2"})
  2465.      *
  2466.      * @Serializer\VirtualProperty
  2467.      *
  2468.      * @Serializer\SerializedName("phones")
  2469.      *
  2470.      * @Serializer\Expose
  2471.      *
  2472.      * @return array
  2473.      */
  2474.     public function getMappedPhones()
  2475.     {
  2476.         $phones = [];
  2477.         /** @var $phone ListingPhone */
  2478.         foreach ($this->getPhones() as $phone) {
  2479.             $phones[] = $phone->getPhone();
  2480.         }
  2481.         return $phones;
  2482.     }
  2483.     /**
  2484.      * Get phones for listing from the user phones.
  2485.      *
  2486.      * @Serializer\Groups({"List", "Details", "listingDetails", "SearchV4"})
  2487.      *
  2488.      * @Serializer\VirtualProperty
  2489.      *
  2490.      * @Serializer\Expose
  2491.      */
  2492.     public function getListingPhones(): ArrayCollection
  2493.     {
  2494.         $phones = new ArrayCollection();
  2495.         $i 0;
  2496.         /** @var UserPhone $phone */
  2497.         foreach ($this->getUser()->getPhones() as $phone) {
  2498.             if ($i 2) {
  2499.                 break;
  2500.             }
  2501.             $criteria Criteria::create()->where(Criteria::expr()->eq('number'$phone->getNumber()));
  2502.             if ($phones->matching($criteria)->isEmpty() && $phone->getPhone() instanceof Phone) {
  2503.                 $phones->add($phone->getPhone());
  2504.             }
  2505.             ++$i;
  2506.         }
  2507.         return $phones;
  2508.     }
  2509.     /**
  2510.      * Add photos.
  2511.      *
  2512.      * @return Listing
  2513.      */
  2514.     public function addPhoto(ListingPhoto $photo)
  2515.     {
  2516.         $photo->setListing($this);
  2517.         $this->photos->add($photo);
  2518.         return $this;
  2519.     }
  2520.     /**
  2521.      * Set photos.
  2522.      *
  2523.      * @return Listing
  2524.      */
  2525.     public function setPhotos($photos)
  2526.     {
  2527.         foreach ($photos as $photo) {
  2528.             $this->addPhoto($photo);
  2529.         }
  2530.         return $this;
  2531.     }
  2532.     /**
  2533.      * Remove photos.
  2534.      */
  2535.     public function removePhoto(ListingPhoto $photo): void
  2536.     {
  2537.         $this->photos->removeElement($photo);
  2538.     }
  2539.     /**
  2540.      * @return $this
  2541.      */
  2542.     public function clearPhotos()
  2543.     {
  2544.         $this->photos->clear();
  2545.         return $this;
  2546.     }
  2547.     /**
  2548.      * @return $this
  2549.      */
  2550.     public function clearPhones()
  2551.     {
  2552.         $this->phones->clear();
  2553.         return $this;
  2554.     }
  2555.     /**
  2556.      * @return CompoundAveragePrice|null
  2557.      */
  2558.     public function getCompoundAveragePrices()
  2559.     {
  2560.         return $this->compoundAveragePrices;
  2561.     }
  2562.     /**
  2563.      * @param CompoundAveragePrice|null
  2564.      */
  2565.     public function setCompoundAveragePrices(?CompoundAveragePrice $compoundAveragePrices): void
  2566.     {
  2567.         $this->compoundAveragePrices $compoundAveragePrices;
  2568.     }
  2569.     /**
  2570.      * @return ArrayCollection
  2571.      */
  2572.     public function getPhotos($excludedTypes = [])
  2573.     {
  2574.         $criteria Criteria::create();
  2575.         if (!empty($excludedTypes)) {
  2576.             $criteria->andWhere(Criteria::expr()->notIn('type'$excludedTypes));
  2577.         }
  2578.         $criteria->orderBy(['order' => Criteria::ASC]);
  2579.         return $this->photos->matching($criteria);
  2580.     }
  2581.     /**
  2582.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  2583.      *
  2584.      * @Serializer\VirtualProperty
  2585.      *
  2586.      * @Serializer\SerializedName("photos")
  2587.      *
  2588.      * @return ArrayCollection
  2589.      */
  2590.     public function getPhotosForSlider()
  2591.     {
  2592.         $slider = new ArrayCollection();
  2593.         // Set the main photo as the first photo in the slider
  2594.         if ($this->getMainPhoto()) {
  2595.             $slider->add($this->getMainPhoto());
  2596.         }
  2597.         // Add all other photos, except the main photo, because It's already added
  2598.         /** @var ListingPhoto $photo */
  2599.         foreach ($this->getPhotos() as $photo) {
  2600.             if (!$slider->contains($photo) && PhotoTypes::LOGO_PHOTO != $photo->getType()) {
  2601.                 $slider->add($photo);
  2602.             }
  2603.         }
  2604.         return $slider;
  2605.     }
  2606.     public function buildMappedMainPhoto(): self
  2607.     {
  2608.         // Important for API
  2609.         if ($this->getPhotos()->count() <= 0) {
  2610.             return $this;
  2611.         }
  2612.         /* @var ListingPhoto $photo */
  2613.         $mainPhotos $this->photos->filter(fn ($photo) => PhotoTypes::MAIN_PHOTO == $photo->getType());
  2614.         $mappedMainPhoto $mainPhotos->first() ?: $this->getPhotos()->first();
  2615.         if ($mappedMainPhoto instanceof ListingPhoto) {
  2616.             $this->mappedMainPhoto $this->mapPhoto($mappedMainPhoto);
  2617.         }
  2618.         return $this;
  2619.     }
  2620.     public function setMappedMainPhoto(?array $mainPhoto): self
  2621.     {
  2622.         $this->mappedMainPhoto $mainPhoto;
  2623.         return $this;
  2624.     }
  2625.     /**
  2626.      * @Serializer\Groups({"DefaultV4", "MyListing", "MyListings", "SearchV4", "ProjectSearchV4", "RelatedListingsV2", "locationListingV2", "homeCompoundV2"})
  2627.      *
  2628.      * @Serializer\VirtualProperty
  2629.      *
  2630.      * @Serializer\SerializedName("mainPhoto")
  2631.      */
  2632.     public function getMappedMainPhoto(): ?array
  2633.     {
  2634.         return $this->mappedMainPhoto;
  2635.     }
  2636.     private function mapPhoto(ListingPhoto $listingPhoto): array
  2637.     {
  2638.         return [
  2639.             'id' => $listingPhoto->getId(),
  2640.             'name' => $listingPhoto->getName(),
  2641.             'caption' => $listingPhoto->getCaption(),
  2642.             'order' => $listingPhoto->getOrder(),
  2643.             'type' => $listingPhoto->getTypeName(),
  2644.             'photo' => $listingPhoto->getFile(),
  2645.             'file' => $listingPhoto->getPath(),
  2646.             'thumbnails' => [],
  2647.         ];
  2648.     }
  2649.     public function buildMappedPhotos(): self
  2650.     {
  2651.         $mainPhotoId null;
  2652.         // Set the main photo as the first photo in the slider
  2653.         if ($this->getMainPhoto() instanceof ListingPhoto) {
  2654.             $mainPhoto $this->getMainPhoto();
  2655.             $mainPhotoId $mainPhoto->getId();
  2656.             $this->mappedPhotos[] = $this->mapPhoto($mainPhoto);
  2657.         }
  2658.         /** @var ListingPhoto $photo */
  2659.         foreach ($this->getPhotos() as $photo) {
  2660.             if (PhotoTypes::LOGO_PHOTO != $photo->getType()) {
  2661.                 if (($mainPhotoId && $mainPhotoId == $photo->getId()) || !$photo instanceof ListingPhoto) {
  2662.                     continue;
  2663.                 }
  2664.                 $this->mappedPhotos[] = $this->mapPhoto($photo);
  2665.             }
  2666.         }
  2667.         return $this;
  2668.     }
  2669.     /**
  2670.      * @Serializer\Groups({"DefaultV4", "SearchV4", "ProjectDetailsV4", "RelatedListingsV2"})
  2671.      *
  2672.      * @Serializer\VirtualProperty
  2673.      *
  2674.      * @Serializer\SerializedName("photos")
  2675.      *
  2676.      * @return array
  2677.      */
  2678.     public function getMappedPhotos()
  2679.     {
  2680.         return $this->mappedPhotos;
  2681.     }
  2682.     public function setMappedPhotos(array $mappedPhotos): self
  2683.     {
  2684.         $this->mappedPhotos $mappedPhotos;
  2685.         return $this;
  2686.     }
  2687.     /**
  2688.      * @Serializer\Groups({"List", "Api", "Preview"})
  2689.      *
  2690.      * @Serializer\VirtualProperty
  2691.      */
  2692.     public function getMainPhoto(): ?ListingPhoto
  2693.     {
  2694.         // Important for API
  2695.         if ($this->getPhotos()->count() <= 0) {
  2696.             return null;
  2697.         }
  2698.         /* @var ListingPhoto $photo */
  2699.         $mainPhotos $this->photos->filter(fn ($photo) => PhotoTypes::MAIN_PHOTO == $photo->getType());
  2700.         return $mainPhotos->first() ?: $this->getPhotos()->first();
  2701.     }
  2702.     /**
  2703.      * @Serializer\Groups({"DefaultV4", "MyListing", "SearchV4", "ProjectSearchV4"})
  2704.      *
  2705.      * @Serializer\VirtualProperty
  2706.      *
  2707.      * @return int
  2708.      */
  2709.     public function getPhotosCount()
  2710.     {
  2711.         return $this->getPhotos()->count();
  2712.     }
  2713.     /**
  2714.      * @return ListingPhoto|null
  2715.      */
  2716.     public function getLogo()
  2717.     {
  2718.         /** @var ArrayCollection $logos */
  2719.         $logos $this->photos->filter(fn (ListingPhoto $photo) => PhotoTypes::LOGO_PHOTO == $photo->getType());
  2720.         return $logos->first() ?: null;
  2721.     }
  2722.     /**
  2723.      * @return ArrayCollection
  2724.      */
  2725.     public function getLeads()
  2726.     {
  2727.         return $this->leads;
  2728.     }
  2729.     /**
  2730.      * Count leads.
  2731.      *
  2732.      * @return int
  2733.      */
  2734.     public function getLeadsCount()
  2735.     {
  2736.         return $this->getLeadsCounter();
  2737.     }
  2738.     /**
  2739.      * Count all leads with children.
  2740.      *
  2741.      * @return int
  2742.      */
  2743.     public function getTotalLeadsCount()
  2744.     {
  2745.         $leadsCount $this->getLeadsCounter();
  2746.         if ($this->getChildren()) {
  2747.             /** @var self $listing */
  2748.             foreach ($this->getChildren() as $listing) {
  2749.                 $leadsCount += $listing->getLeadsCounter();
  2750.             }
  2751.         }
  2752.         return $leadsCount;
  2753.     }
  2754.     public function setLeads($leads): void
  2755.     {
  2756.         $this->leads $leads;
  2757.     }
  2758.     /**
  2759.      * @Serializer\VirtualProperty()
  2760.      *
  2761.      * @return int
  2762.      */
  2763.     public function getAggregatedLeadsCount()
  2764.     {
  2765.         /** @var ListingFeature $lastBump */
  2766.         $lastBump $this->getLastAutoBumpUp();
  2767.         /** @var ListingFeature $lastFeature */
  2768.         $lastFeature $this->getLastListingFeature();
  2769.         $listingFeature null;
  2770.         if ($lastBump && $lastFeature) {
  2771.             $listingFeature = ($lastBump->getLastBumpedAt() > $lastFeature->getCreatedAt()) ? $lastBump $lastFeature;
  2772.         } elseif ($lastBump) {
  2773.             $listingFeature $lastBump;
  2774.         } elseif ($lastFeature) {
  2775.             $listingFeature $lastFeature;
  2776.         }
  2777.         return $listingFeature ?
  2778.             $this->getLeadsCounter() - $listingFeature->getLeadsCountSnapshot() :
  2779.             $this->getLeadsCounter();
  2780.     }
  2781.     /**
  2782.      * Add listingFeatures.
  2783.      *
  2784.      * @return Listing
  2785.      */
  2786.     public function addListingFeature(ListingFeature $listingFeatures)
  2787.     {
  2788.         $this->listingFeatures[] = $listingFeatures;
  2789.         return $this;
  2790.     }
  2791.     /**
  2792.      * Remove listingFeatures.
  2793.      */
  2794.     public function removeListingFeature(ListingFeature $listingFeatures): void
  2795.     {
  2796.         $this->listingFeatures->removeElement($listingFeatures);
  2797.     }
  2798.     /**
  2799.      * Get listingFeatures.
  2800.      *
  2801.      * @return Collection
  2802.      */
  2803.     public function getListingFeatures()
  2804.     {
  2805.         return $this->listingFeatures;
  2806.     }
  2807.     /**
  2808.      * @return ListingFeature
  2809.      */
  2810.     public function getLastAutoBumpUp()
  2811.     {
  2812.         $criteria = new Criteria();
  2813.         $criteria
  2814.             ->where(Criteria::expr()->eq('type'ListingFeatures::BUMP_UP))
  2815.             ->andWhere(Criteria::expr()->gte('expiresAt', new \DateTime()))
  2816.             ->orWhere(Criteria::expr()->isNull('expiresAt'))
  2817.             ->orderBy([
  2818.                 'id' => Criteria::DESC,
  2819.             ])
  2820.         ;
  2821.         return $this->listingFeatures->matching($criteria)->first();
  2822.     }
  2823.     /**
  2824.      * @Serializer\VirtualProperty
  2825.      *
  2826.      * @Serializer\SerializedName("was_featured")
  2827.      *
  2828.      * @Serializer\Groups({"List", "Details", "listingDetails"})
  2829.      *
  2830.      * @return bool
  2831.      */
  2832.     public function wasFeatured()
  2833.     {
  2834.         return !$this->getCurrentListingFeature() && $this->getLastListingFeature() ? true false;
  2835.     }
  2836.     /**
  2837.      * Get current listing feature.
  2838.      *
  2839.      * @return ListingFeatures
  2840.      */
  2841.     public function getCurrentListingFeature()
  2842.     {
  2843.         $criteria Criteria::create()
  2844.             ->where(Criteria::expr()->gte('expiresAt', new \DateTime('now')))
  2845.             ->andWhere(Criteria::expr()->neq('type'ListingFeatures::PAID))
  2846.             ->andWhere(Criteria::expr()->neq('type'ListingFeatures::BUMP_UP))
  2847.             ->orderBy(['id' => Criteria::DESC])
  2848.             ->setMaxResults(1);
  2849.         return $this->getListingFeatures()->matching($criteria)->first();
  2850.     }
  2851.     /**
  2852.      * Get current listing feature expiry date.
  2853.      *
  2854.      * @return \DateTime|null
  2855.      *
  2856.      * @Serializer\VirtualProperty()
  2857.      *
  2858.      * @Serializer\Groups({"DefaultV4", "MyListing"})
  2859.      *
  2860.      * @Serializer\SerializedName("feature_expires_at")
  2861.      *
  2862.      * @Serializer\Expose
  2863.      */
  2864.     public function getCurrentListingFeatureExpiryDate()
  2865.     {
  2866.         /* @var ListingFeature $listingFeature */
  2867.         if ($this->isFeatured()) {
  2868.             $listingFeature $this->getCurrentListingFeature();
  2869.             return $listingFeature $listingFeature->getExpiresAt() : null;
  2870.         }
  2871.         return null;
  2872.     }
  2873.     /**
  2874.      * Get all current active listing features.
  2875.      *
  2876.      * @return ListingFeatures
  2877.      */
  2878.     public function getCurrentListingFeatures()
  2879.     {
  2880.         $criteria Criteria::create()
  2881.             ->where(Criteria::expr()->orX(
  2882.                 Criteria::expr()->isNull('expiresAt'),
  2883.                 Criteria::expr()->gte('expiresAt', new \DateTime('now'))
  2884.             ))
  2885.             ->orderBy(['id' => Criteria::DESC]);
  2886.         return $this->getListingFeatures()->matching($criteria);
  2887.     }
  2888.     /**
  2889.      * Get last listing feature.
  2890.      */
  2891.     public function getLastListingFeature()
  2892.     {
  2893.         $criteria Criteria::create()
  2894.             ->andWhere(Criteria::expr()->neq('type'ListingFeatures::PAID))
  2895.             ->andWhere(Criteria::expr()->neq('type'ListingFeatures::BUMP_UP))
  2896.             ->orderBy(['id' => Criteria::DESC])
  2897.             ->setMaxResults(1);
  2898.         return $this->getListingFeatures()->matching($criteria)->first();
  2899.     }
  2900.     /**
  2901.      * Get the latest  featured credit transaction for listing publishing.
  2902.      *
  2903.      * @param mixed $type = null
  2904.      *
  2905.      * @throws \Exception
  2906.      */
  2907.     public function getFeaturedPublicationCredit($type null)
  2908.     {
  2909.         if (!$type) {
  2910.             $lastFeaturedType $this->getLastListingFeature() ? $this->getLastListingFeature()->getType() : [];
  2911.             $type = !empty($lastFeaturedType) ? [$lastFeaturedType] : [ListingFeatures::FEATUREDListingFeatures::SPOTLIGHTListingFeatures::PREMIUMListingFeatures::SPONSORED];
  2912.         }
  2913.         $criteria Criteria::create()
  2914.             ->where(Criteria::expr()->orX(
  2915.                 Criteria::expr()->isNull('expiresAt'),
  2916.                 Criteria::expr()->gte('expiresAt', new \DateTime('now'))
  2917.             ))
  2918.             ->andWhere(Criteria::expr()->in('type'$type))
  2919.             ->orderBy(['id' => Criteria::DESC])
  2920.             ->setMaxResults(1);
  2921.         return $this->getListingFeatures()->matching($criteria)->first();
  2922.     }
  2923.     /**
  2924.      * Get the latest credit transaction for listing publishing.
  2925.      *
  2926.      * @return ListingFeature
  2927.      */
  2928.     public function getPublicationCredit()
  2929.     {
  2930.         $criteria Criteria::create()
  2931.             ->where(Criteria::expr()->orX(
  2932.                 Criteria::expr()->isNull('expiresAt'),
  2933.                 Criteria::expr()->gte('expiresAt', new \DateTime('now'))
  2934.             ))
  2935.             ->andWhere(Criteria::expr()->eq('type'ListingFeatures::PAID))
  2936.             ->orderBy(['id' => Criteria::DESC])
  2937.             ->setMaxResults(1);
  2938.         return $this->getListingFeatures()->matching($criteria)->first();
  2939.     }
  2940.     /**
  2941.      * Get the latest credit transaction for special add listing publishing.
  2942.      *
  2943.      * @return ListingFeature
  2944.      */
  2945.     public function getSpecialPublicationCredit()
  2946.     {
  2947.         $criteria Criteria::create()
  2948.             ->where(Criteria::expr()->orX(
  2949.                 Criteria::expr()->isNull('expiresAt'),
  2950.                 Criteria::expr()->gte('expiresAt', new \DateTime('now'))
  2951.             ))
  2952.             ->andWhere(Criteria::expr()->in('type', [ListingFeatures::SPONSOREDListingFeatures::SPOTLIGHT]))
  2953.             ->orderBy(['id' => Criteria::DESC])
  2954.             ->setMaxResults(1);
  2955.         return $this->getListingFeatures()->matching($criteria)->first();
  2956.     }
  2957.     /**
  2958.      * Get all credit transactions for listing that not expired yet.
  2959.      *
  2960.      * @return ListingFeature
  2961.      */
  2962.     public function getNotExpiredCredit()
  2963.     {
  2964.         $criteria Criteria::create()
  2965.             ->where(Criteria::expr()->orX(
  2966.                 Criteria::expr()->isNull('expiresAt'),
  2967.                 Criteria::expr()->gte('expiresAt', new \DateTime('now'))
  2968.             ))
  2969.             ->orderBy(['id' => Criteria::DESC]);
  2970.         return $this->getListingFeatures()->matching($criteria)->toArray();
  2971.     }
  2972.     /**
  2973.      * Get translations.
  2974.      *
  2975.      * @Serializer\VirtualProperty
  2976.      *
  2977.      * @Serializer\Groups({"Default", "List"})
  2978.      *
  2979.      * @Serializer\SerializedName("translations")
  2980.      *
  2981.      * @Serializer\Expose
  2982.      *
  2983.      * @return ArrayCollection
  2984.      */
  2985.     public function getTranslations()
  2986.     {
  2987.         return $this->translations;
  2988.     }
  2989.     public function deleteExistingTranslation($field$locale): void
  2990.     {
  2991.         /** @var ListingTranslation $translation */
  2992.         foreach ($this->getTranslations() as $translation) {
  2993.             if ($translation->getField() == $field && $translation->getLocale() == $locale) {
  2994.                 $this->removeTranslation($translation);
  2995.             }
  2996.         }
  2997.     }
  2998.     /**
  2999.      * Add translation.
  3000.      *
  3001.      * @return Listing
  3002.      */
  3003.     public function addTranslation(ListingTranslation $translation)
  3004.     {
  3005.         if (!$this->translations->contains($translation)) {
  3006.             $this->translations->add($translation);
  3007.             $translation->setObject($this);
  3008.         }
  3009.         return $this;
  3010.     }
  3011.     /**
  3012.      * Set Translations.
  3013.      *
  3014.      * @return Listing
  3015.      */
  3016.     public function setTranslations($translations)
  3017.     {
  3018.         foreach ($translations as $translation) {
  3019.             $this->addTranslation($translation);
  3020.         }
  3021.         return $this;
  3022.     }
  3023.     /**
  3024.      * Remove translation.
  3025.      *
  3026.      * @return Listing
  3027.      */
  3028.     public function removeTranslation(ListingTranslation $translation)
  3029.     {
  3030.         if ($this->translations->contains($translation)) {
  3031.             $this->translations->removeElement($translation);
  3032.         }
  3033.         return $this;
  3034.     }
  3035.     /**
  3036.      * @return $this
  3037.      */
  3038.     public function clearTranslations()
  3039.     {
  3040.         $this->translations->clear();
  3041.         return $this;
  3042.     }
  3043.     /**
  3044.      * Set campaign.
  3045.      *
  3046.      * @param string $campaign
  3047.      *
  3048.      * @return Listing
  3049.      */
  3050.     public function setCampaign($campaign)
  3051.     {
  3052.         $this->campaign $campaign;
  3053.         return $this;
  3054.     }
  3055.     /**
  3056.      * Get campaign.
  3057.      *
  3058.      * @return string
  3059.      */
  3060.     public function getCampaign()
  3061.     {
  3062.         return $this->campaign;
  3063.     }
  3064.     /**
  3065.      * Set propertyView.
  3066.      *
  3067.      * @param int $propertyView
  3068.      *
  3069.      * @return Listing
  3070.      */
  3071.     public function setPropertyView($propertyView)
  3072.     {
  3073.         $this->propertyView $propertyView;
  3074.         return $this;
  3075.     }
  3076.     /**
  3077.      * Get propertyView.
  3078.      *
  3079.      * @return int
  3080.      */
  3081.     public function getPropertyView()
  3082.     {
  3083.         return $this->propertyView;
  3084.     }
  3085.     /**
  3086.      * @Serializer\SerializedName("property_view_label")
  3087.      *
  3088.      * @Serializer\VirtualProperty()
  3089.      *
  3090.      * @Serializer\Groups({"Details", "listingDetails"})
  3091.      *
  3092.      * @Serializer\Expose
  3093.      */
  3094.     public function getPropertyViewLabel()
  3095.     {
  3096.         return ListingPropertyView::getLabel($this->getPropertyView());
  3097.     }
  3098.     /**
  3099.      * @Serializer\SerializedName("property_view_label")
  3100.      *
  3101.      * @Serializer\VirtualProperty()
  3102.      *
  3103.      * @Serializer\Since("v2.12")
  3104.      *
  3105.      * @Serializer\Expose()
  3106.      */
  3107.     public function getPropertyViewTranslatedLabel()
  3108.     {
  3109.         return $this->getTranslatedPropertyViewLabel();
  3110.     }
  3111.     /**
  3112.      * @Serializer\SerializedName("property_view")
  3113.      *
  3114.      * @Serializer\VirtualProperty()
  3115.      *
  3116.      * @Serializer\Groups({"DefaultV4"})
  3117.      *
  3118.      * @Serializer\Expose()
  3119.      */
  3120.     public function getPropertyViewName()
  3121.     {
  3122.         return ListingPropertyView::getNameByConstant($this->getPropertyView());
  3123.     }
  3124.     /**
  3125.      * @return $this
  3126.      */
  3127.     public function setPropertyViewLabel($label)
  3128.     {
  3129.         $this->propertyViewLabel $label;
  3130.         return $this;
  3131.     }
  3132.     /**
  3133.      * Set paymentMethod.
  3134.      *
  3135.      * @param int $paymentMethod
  3136.      *
  3137.      * @return Listing
  3138.      */
  3139.     public function setPaymentMethod($paymentMethod)
  3140.     {
  3141.         if (
  3142.             ListingSections::FOR_RENT == $this->getSection()->getId()
  3143.         ) {
  3144.             $paymentMethod ListingPaymentMethod::CASH;
  3145.         }
  3146.         $this->paymentMethod $paymentMethod;
  3147.         return $this;
  3148.     }
  3149.     /**
  3150.      * Set paymentMethod Label.
  3151.      *
  3152.      * @param int $paymentMethod
  3153.      *
  3154.      * @return Listing
  3155.      */
  3156.     public function setPaymentMethodLabel($paymentMethod)
  3157.     {
  3158.         $this->paymentMethodLabel $paymentMethod;
  3159.         return $this;
  3160.     }
  3161.     /**
  3162.      * @Serializer\SerializedName("payment_method_label")
  3163.      *
  3164.      * @Serializer\VirtualProperty()
  3165.      *
  3166.      * @Serializer\Since("v2.12")
  3167.      *
  3168.      * @Serializer\Expose()
  3169.      */
  3170.     public function getPaymentMethodLabelTranslated()
  3171.     {
  3172.         return $this->paymentMethodLabel;
  3173.     }
  3174.     /**
  3175.      * @Serializer\SerializedName("user")
  3176.      *
  3177.      * @Serializer\VirtualProperty()
  3178.      *
  3179.      * @Serializer\Groups({"DefaultV4"})
  3180.      *
  3181.      * @Serializer\Expose()
  3182.      *
  3183.      * @return int|null
  3184.      */
  3185.     public function getUserId()
  3186.     {
  3187.         return $this->getUser() instanceof User $this->getUser()->getId() : null;
  3188.     }
  3189.     /**
  3190.      * Get paymentMethod.
  3191.      *
  3192.      * @return int
  3193.      */
  3194.     public function getPaymentMethod()
  3195.     {
  3196.         if (
  3197.             ListingSections::FOR_RENT == $this->getSection()->getId()
  3198.         ) {
  3199.             $this->paymentMethod ListingPaymentMethod::CASH;
  3200.         }
  3201.         return $this->paymentMethod;
  3202.     }
  3203.     /**
  3204.      * @Serializer\SerializedName("paymentMethodLabel")
  3205.      *
  3206.      * @Serializer\VirtualProperty()
  3207.      *
  3208.      * @Serializer\Groups({"Default", "SearchV4", "listingDetails"})
  3209.      *
  3210.      * @Serializer\Expose()
  3211.      */
  3212.     public function getPaymentMethodLabel()
  3213.     {
  3214.         return ListingPaymentMethod::getLabel($this->getPaymentMethod());
  3215.     }
  3216.     /**
  3217.      * Add listingNotification.
  3218.      *
  3219.      * @return Listing
  3220.      */
  3221.     public function addListingNotification(ListingNotification $listingNotification)
  3222.     {
  3223.         $this->ListingNotifications[] = $listingNotification;
  3224.         return $this;
  3225.     }
  3226.     /**
  3227.      * Remove listingNotification.
  3228.      */
  3229.     public function removeListingNotification(ListingNotification $listingNotification): void
  3230.     {
  3231.         $this->ListingNotifications->removeElement($listingNotification);
  3232.     }
  3233.     /**
  3234.      * Get listingNotifications.
  3235.      *
  3236.      * @return Collection
  3237.      */
  3238.     public function getListingNotifications()
  3239.     {
  3240.         return $this->ListingNotifications;
  3241.     }
  3242.     /**
  3243.      * Add rejections.
  3244.      *
  3245.      * @return Listing
  3246.      */
  3247.     public function addRejection(Rejection $rejections)
  3248.     {
  3249.         $this->rejections[] = $rejections;
  3250.         return $this;
  3251.     }
  3252.     /**
  3253.      * Add rejections.
  3254.      *
  3255.      * @param ArrayCollection $rejections
  3256.      *
  3257.      * @return Listing
  3258.      */
  3259.     public function addRejections($rejections)
  3260.     {
  3261.         $this->rejections $rejections;
  3262.         return $this;
  3263.     }
  3264.     /**
  3265.      * Remove rejections.
  3266.      */
  3267.     public function removeRejections(Rejection $rejections): void
  3268.     {
  3269.         $this->rejections->removeElement($rejections);
  3270.     }
  3271.     /**
  3272.      * Get rejections.
  3273.      *
  3274.      * @return Collection
  3275.      */
  3276.     public function getRejections()
  3277.     {
  3278.         return $this->rejections;
  3279.     }
  3280.     public function setRejections($rejections): void
  3281.     {
  3282.         $this->rejections $rejections;
  3283.     }
  3284.     /**
  3285.      * Set phoneCounter.
  3286.      *
  3287.      * @param int $phoneCounter
  3288.      *
  3289.      * @return Listing
  3290.      */
  3291.     public function setPhoneCounter($phoneCounter)
  3292.     {
  3293.         $this->phoneCounter $phoneCounter;
  3294.         return $this;
  3295.     }
  3296.     /**
  3297.      * Get phoneCounter.
  3298.      *
  3299.      * @return int
  3300.      */
  3301.     public function getPhoneCounter()
  3302.     {
  3303.         return $this->phoneCounter;
  3304.     }
  3305.     /**
  3306.      * Set messagesCounter.
  3307.      *
  3308.      * @param int $messagesCounter
  3309.      *
  3310.      * @return Listing
  3311.      */
  3312.     public function setMessagesCounter($messagesCounter)
  3313.     {
  3314.         $this->messagesCounter $messagesCounter;
  3315.         return $this;
  3316.     }
  3317.     /**
  3318.      * Get messagesCounter.
  3319.      *
  3320.      * @return int
  3321.      */
  3322.     public function getMessagesCounter()
  3323.     {
  3324.         return $this->messagesCounter;
  3325.     }
  3326.     /**
  3327.      * @return int
  3328.      */
  3329.     public function getFinalPrice()
  3330.     {
  3331.         return $this->finalPrice;
  3332.     }
  3333.     /**
  3334.      * @param int $finalPrice
  3335.      */
  3336.     public function setFinalPrice($finalPrice): void
  3337.     {
  3338.         $this->finalPrice $finalPrice;
  3339.     }
  3340.     /**
  3341.      * @return string
  3342.      */
  3343.     public function getSourceOfSale()
  3344.     {
  3345.         return $this->sourceOfSale;
  3346.     }
  3347.     /**
  3348.      * @param string $sourceOfSale
  3349.      */
  3350.     public function setSourceOfSale($sourceOfSale): void
  3351.     {
  3352.         $this->sourceOfSale $sourceOfSale;
  3353.     }
  3354.     /**
  3355.      * @return string
  3356.      */
  3357.     public function getDeleteReason()
  3358.     {
  3359.         return $this->deleteReason;
  3360.     }
  3361.     /**
  3362.      * @param string $deleteReason
  3363.      */
  3364.     public function setDeleteReason($deleteReason): void
  3365.     {
  3366.         $this->deleteReason $deleteReason;
  3367.     }
  3368.     /**
  3369.      * @return string
  3370.      */
  3371.     public function getDeleteReasonDetails()
  3372.     {
  3373.         return $this->deleteReasonDetails;
  3374.     }
  3375.     /**
  3376.      * @param string $deleteReasonDetails
  3377.      */
  3378.     public function setDeleteReasonDetails($deleteReasonDetails): void
  3379.     {
  3380.         $this->deleteReasonDetails $deleteReasonDetails;
  3381.     }
  3382.     public function getInteractions()
  3383.     {
  3384.         return $this->interactions;
  3385.     }
  3386.     public function setInteractions($interactions): void
  3387.     {
  3388.         $this->interactions $interactions;
  3389.     }
  3390.     /**
  3391.      * @Serializer\VirtualProperty
  3392.      *
  3393.      * @Serializer\SerializedName("logo")
  3394.      *
  3395.      * @Serializer\Groups({"List", "Details", "listingDetails", "DefaultV4", "ProjectSearchV4", "ProjectDetailsV4", "locationListingV2"})
  3396.      */
  3397.     public function getSerializedLogo()
  3398.     {
  3399.         // Giving pariority for listing logo then userLogo
  3400.         return $this->getListingLogo() ?: ($this->getUserLogo() ?: null);
  3401.     }
  3402.     /**
  3403.      * @return string
  3404.      */
  3405.     public function getUserLogo()
  3406.     {
  3407.         return $this->userLogo;
  3408.     }
  3409.     /**
  3410.      * @param string $userLogo
  3411.      */
  3412.     public function setUserLogo($userLogo): void
  3413.     {
  3414.         $this->userLogo $userLogo;
  3415.     }
  3416.     public function getValidUserLogo(): ?Photo
  3417.     {
  3418.         if ($user $this->getUser()) {
  3419.             if ($user->hasValidAccessToLogoExposure()) {
  3420.                 return $user->getLogo();
  3421.             }
  3422.         }
  3423.         return null;
  3424.     }
  3425.     /**
  3426.      * @return string
  3427.      */
  3428.     public function getListingLogo()
  3429.     {
  3430.         return $this->listingLogo;
  3431.     }
  3432.     /**
  3433.      * @param string $listingLogo
  3434.      */
  3435.     public function setListingLogo($listingLogo): void
  3436.     {
  3437.         $this->listingLogo $listingLogo;
  3438.     }
  3439.     public function setTranslatableLocale($locale): void
  3440.     {
  3441.         $this->locale $locale;
  3442.     }
  3443.     /**
  3444.      * @return bool
  3445.      */
  3446.     public function canChangeScrapedListing()
  3447.     {
  3448.         return ListingCategories::SCRAPPED == $this->category
  3449.             && ScrapedListing::USER_EMAIL === $this->getUser()->getEmail();
  3450.     }
  3451.     /**
  3452.      * @param null $hash
  3453.      *
  3454.      * @return bool
  3455.      */
  3456.     public function validateScrapedListingHash($hash null)
  3457.     {
  3458.         $secretHash md5($this->getPhones()->first()->getNumber().''.$this->getId());
  3459.         if ($hash === $secretHash) {
  3460.             return true;
  3461.         }
  3462.         return false;
  3463.     }
  3464.     public function getSource()
  3465.     {
  3466.         return $this->source;
  3467.     }
  3468.     public function setSource($source): void
  3469.     {
  3470.         $this->source $source;
  3471.     }
  3472.     public function setElasticSearchScore($elasticSearchScore): void
  3473.     {
  3474.         $this->elasticSearchScore $elasticSearchScore;
  3475.     }
  3476.     /**
  3477.      * @return float
  3478.      */
  3479.     public function getElasticSearchScore()
  3480.     {
  3481.         return $this->elasticSearchScore;
  3482.     }
  3483.     /**
  3484.      * @param float $qualityScore
  3485.      */
  3486.     public function setQualityScore($qualityScore): void
  3487.     {
  3488.         $this->qualityScore $qualityScore;
  3489.     }
  3490.     /**
  3491.      * @return float
  3492.      */
  3493.     public function getQualityScore()
  3494.     {
  3495.         return $this->photos->count();
  3496.     }
  3497.     /**
  3498.      * @return int
  3499.      */
  3500.     public function getLeadsCounter()
  3501.     {
  3502.         return $this->leadsCounter;
  3503.     }
  3504.     /**
  3505.      * @param int $leadsCounter
  3506.      *
  3507.      * @return Listing
  3508.      */
  3509.     public function setLeadsCounter($leadsCounter)
  3510.     {
  3511.         $this->leadsCounter $leadsCounter;
  3512.         return $this;
  3513.     }
  3514.     /**
  3515.      * Get price per meter.
  3516.      *
  3517.      * @return int|null
  3518.      */
  3519.     public function calculatePricePerMeter()
  3520.     {
  3521.         if (!$this->getArea()) {
  3522.             return null;
  3523.         }
  3524.         $area = ($this->getArea() > 0) ? $this->getArea() : 1;
  3525.         return $this->getPrice() / $area;
  3526.     }
  3527.     /**
  3528.      * @return int
  3529.      */
  3530.     public function getImpressions()
  3531.     {
  3532.         return $this->impressions;
  3533.     }
  3534.     /**
  3535.      * @param int $impressions
  3536.      *
  3537.      * @return Listing
  3538.      */
  3539.     public function setImpressions($impressions)
  3540.     {
  3541.         $this->impressions $impressions;
  3542.         return $this;
  3543.     }
  3544.     /**
  3545.      * @return $this
  3546.      */
  3547.     public function setImpressionsMonthlyCount(?int $impressions null)
  3548.     {
  3549.         $this->impressionsMonthlyCount $impressions;
  3550.         return $this;
  3551.     }
  3552.     /**
  3553.      * @return int
  3554.      */
  3555.     public function getImpressionsMonthlyCount()
  3556.     {
  3557.         return $this->impressionsMonthlyCount;
  3558.     }
  3559.     /**
  3560.      * @return $this
  3561.      */
  3562.     public function setImpressionsWeeklyCount(?int $impressions null)
  3563.     {
  3564.         $this->impressionsWeeklyCount $impressions;
  3565.         return $this;
  3566.     }
  3567.     public function getImpressionsWeeklyCount()
  3568.     {
  3569.         return $this->impressionsWeeklyCount;
  3570.     }
  3571.     /**
  3572.      * Get impressionUpdatedAt.
  3573.      *
  3574.      * @return \DateTime
  3575.      */
  3576.     public function getImpressionUpdatedAt()
  3577.     {
  3578.         return $this->impressionUpdatedAt;
  3579.     }
  3580.     /**
  3581.      * Set impressionUpdatedAt.
  3582.      *
  3583.      * @param \DateTime $impressionUpdatedAt
  3584.      *
  3585.      * @return Listing
  3586.      */
  3587.     public function setImpressionUpdatedAt($impressionUpdatedAt)
  3588.     {
  3589.         $this->impressionUpdatedAt $impressionUpdatedAt;
  3590.         return $this;
  3591.     }
  3592.     public function getCompoundStatus()
  3593.     {
  3594.         return $this->compoundStatus;
  3595.     }
  3596.     public function setCompoundStatus($compoundStatus)
  3597.     {
  3598.         $this->compoundStatus $compoundStatus;
  3599.         return $this;
  3600.     }
  3601.     /**
  3602.      * @Serializer\VirtualProperty
  3603.      *
  3604.      * @Serializer\SerializedName("compound_status")
  3605.      *
  3606.      * @return string
  3607.      */
  3608.     public function getCompoundStatusLabel()
  3609.     {
  3610.         return CompoundStatus::getLabel($this->getCompoundStatus());
  3611.     }
  3612.     public function setCompoundStatusLabel($label): void
  3613.     {
  3614.         $this->compoundStatusLabel $label;
  3615.     }
  3616.     public function getPriceLevel()
  3617.     {
  3618.         return $this->priceLevel;
  3619.     }
  3620.     public function setPriceLevel($priceLevel)
  3621.     {
  3622.         $this->priceLevel $priceLevel;
  3623.         return $this;
  3624.     }
  3625.     /**
  3626.      * @Serializer\VirtualProperty
  3627.      *
  3628.      * @Serializer\SerializedName("price_level")
  3629.      *
  3630.      * @return string
  3631.      */
  3632.     public function getPriceLevelLabel()
  3633.     {
  3634.         if (!$this->getPriceLevel() && $this->hasParent()) {
  3635.             return ListingPriceLevel::getLabel($this->getParent()->getPriceLevel());
  3636.         }
  3637.         return ListingPriceLevel::getLabel($this->getPriceLevel());
  3638.     }
  3639.     /**
  3640.      * Check if the Listing desn't have the flag and fall back to the parent.
  3641.      *
  3642.      * @return string
  3643.      */
  3644.     public function isParentCommercial()
  3645.     {
  3646.         if (!$this->isCommercial() && $this->hasParent()) {
  3647.             return $this->getParent()->isCommercial();
  3648.         }
  3649.         return $this->isCommercial();
  3650.     }
  3651.     public function setPriceLevelLabel($label): void
  3652.     {
  3653.         $this->priceLevelLabel $label;
  3654.     }
  3655.     public function getPricePerMeter()
  3656.     {
  3657.         return $this->pricePerMeter;
  3658.     }
  3659.     public function setPricePerMeter($pricePerMeter)
  3660.     {
  3661.         $this->pricePerMeter $pricePerMeter;
  3662.         return $this;
  3663.     }
  3664.     public function getChildrenArea()
  3665.     {
  3666.         $result = [];
  3667.         if (empty($this->getChildren())) {
  3668.             return;
  3669.         }
  3670.         foreach ($this->getChildren() as $child) {
  3671.             $result['area'] = (int) $child->getArea();
  3672.         }
  3673.         return $result;
  3674.     }
  3675.     public function getChildrenPrice()
  3676.     {
  3677.         $result = [];
  3678.         if (empty($this->getChildren())) {
  3679.             return;
  3680.         }
  3681.         foreach ($this->getChildren() as $child) {
  3682.             $result['price'] = (int) $child->getPrice();
  3683.         }
  3684.         return $result;
  3685.     }
  3686.     public function getChildrenPricePerMeter()
  3687.     {
  3688.         $result = [];
  3689.         if (empty($this->getChildren())) {
  3690.             return;
  3691.         }
  3692.         foreach ($this->getChildren() as $child) {
  3693.             $result['pricePerMeter'] = (int) $child->getPricePerMeter();
  3694.         }
  3695.         return $result;
  3696.     }
  3697.     public function getChildrenAttributesList()
  3698.     {
  3699.         $result = [];
  3700.         if (empty($this->getChildren())) {
  3701.             return;
  3702.         }
  3703.         foreach ($this->getChildren() as $child) {
  3704.             foreach ($child->getAttributes() as $attribute) {
  3705.                 $result[$attribute->getCustomField()->getName()] = $attribute->getValue();
  3706.             }
  3707.         }
  3708.         return $result;
  3709.     }
  3710.     /**
  3711.      * Returns array of children's property types.
  3712.      */
  3713.     public function getChildrenPropertyType()
  3714.     {
  3715.         $propertyType = [];
  3716.         if (empty($this->getLiveChildren())) {
  3717.             return;
  3718.         }
  3719.         foreach ($this->getLiveChildren() as $child) {
  3720.             $propertyType['id'] = $child->getPropertyType()->getId();
  3721.         }
  3722.         return $propertyType;
  3723.     }
  3724.     /**
  3725.      * Returns array of children's property types.
  3726.      *
  3727.      * @Serializer\VirtualProperty
  3728.      *
  3729.      * @Serializer\SerializedName("childrenPropertyTypes")
  3730.      *
  3731.      * @Serializer\Groups({"locationListingV2", "homeCompoundV2"})
  3732.      *
  3733.      * @Serializer\Expose
  3734.      */
  3735.     public function getChildrenPropertyTypeTitle(): array
  3736.     {
  3737.         $propertyTypes = [];
  3738.         if (empty($this->getLiveChildren())) {
  3739.             return [];
  3740.         }
  3741.         foreach ($this->getLiveChildren() as $child) {
  3742.             $propertyTypes[] = $child->getPropertyType()->getTitle();
  3743.         }
  3744.         return array_values(array_unique($propertyTypes));
  3745.     }
  3746.     public function isBumped(): bool
  3747.     {
  3748.         return (bool) $this->isBumped;
  3749.     }
  3750.     public function setBumped(bool $status true): self
  3751.     {
  3752.         $this->isBumped $status;
  3753.         return $this;
  3754.     }
  3755.     /**
  3756.      * @return bool
  3757.      */
  3758.     public function isSendEmail()
  3759.     {
  3760.         return $this->isSendEmail;
  3761.     }
  3762.     /**
  3763.      * @return $this
  3764.      */
  3765.     public function setIsSendEmail(bool $isSendEmail true)
  3766.     {
  3767.         $this->isSendEmail $isSendEmail;
  3768.         return $this;
  3769.     }
  3770.     /**
  3771.      * @Serializer\VirtualProperty()
  3772.      *
  3773.      * @Serializer\Groups({"DataLayer", "Details", "Search", "DefaultV4", "SearchV4", "listingDetails"})
  3774.      *
  3775.      * @Serializer\Expose
  3776.      *
  3777.      * @return bool
  3778.      */
  3779.     public function hasParent()
  3780.     {
  3781.         return !empty($this->parent);
  3782.     }
  3783.     /**
  3784.      * @Serializer\VirtualProperty()
  3785.      *
  3786.      * @Serializer\Groups({"Details", "Search", "DefaultV4", "SearchV4", "listingDetails"})
  3787.      *
  3788.      * @Serializer\Expose
  3789.      */
  3790.     public function isProjectOrUnit(): bool
  3791.     {
  3792.         return $this->hasParent() || $this->isProject();
  3793.     }
  3794.     /**
  3795.      * @Serializer\VirtualProperty()
  3796.      *
  3797.      * @Serializer\Groups({"DataLayer"})
  3798.      *
  3799.      * @Serializer\Expose
  3800.      */
  3801.     public function hasChildren(): bool
  3802.     {
  3803.         return $this->isProject();
  3804.     }
  3805.     /**
  3806.      * Gets Geo point.
  3807.      */
  3808.     public function getGeoPoint()
  3809.     {
  3810.         if (!$this->getCenterLat() || !$this->getCenterLng()) {
  3811.             return;
  3812.         }
  3813.         return implode(',', [$this->getCenterLat(), $this->getCenterLng()]);
  3814.     }
  3815.     /**
  3816.      * @return ArrayCollection
  3817.      */
  3818.     public function getRates(?\DateTime $startDate null)
  3819.     {
  3820.         $criteria Criteria::create()
  3821.             ->andWhere(Criteria::expr()->lt(
  3822.                 'createdAt',
  3823.                 new \DateTime()
  3824.             ))
  3825.             ->andWhere(Criteria::expr()->gt(
  3826.                 'createdAt',
  3827.                 $startDate ?? new \DateTime(sprintf('-%d Days'ListingRateConstant::DATE_RANGE_START))
  3828.             ));
  3829.         return $this->rates->matching($criteria);
  3830.     }
  3831.     /**
  3832.      * @Serializer\VirtualProperty
  3833.      *
  3834.      * @Serializer\Groups({"Rates"})
  3835.      *
  3836.      * @Serializer\Expose
  3837.      *
  3838.      * @return int
  3839.      */
  3840.     public function getTotalRates(?\DateTime $startDate null)
  3841.     {
  3842.         $totalRates $this->getRates($startDate)->count();
  3843.         if (!$totalRates) {
  3844.             return null;
  3845.         }
  3846.         return round(($this->getPositiveRatesCount($startDate) / $totalRates) * 100);
  3847.     }
  3848.     /**
  3849.      * @Serializer\VirtualProperty()
  3850.      *
  3851.      * @Serializer\Groups({"DefaultV4", "MyListing"})
  3852.      *
  3853.      * @Serializer\SerializedName("score")
  3854.      *
  3855.      * @Serializer\Expose
  3856.      */
  3857.     public function getRateScore()
  3858.     {
  3859.         return $this->getTotalRates();
  3860.     }
  3861.     public function setTotalRates($totalRates): self
  3862.     {
  3863.         $this->totalRates $totalRates;
  3864.         return $this;
  3865.     }
  3866.     /**
  3867.      * @Serializer\VirtualProperty
  3868.      *
  3869.      * @Serializer\Groups({"Rates"})
  3870.      *
  3871.      * @Serializer\SerializedName("positive_rates")
  3872.      *
  3873.      * @Serializer\Expose
  3874.      */
  3875.     public function getPositiveRatesCount(?\DateTime $startDate null)
  3876.     {
  3877.         $criteria Criteria::create()
  3878.             ->where(Criteria::expr()->eq('rate'ListingRateConstant::SATISFYING));
  3879.         return $this->getRates($startDate)->matching($criteria)->count();
  3880.     }
  3881.     /**
  3882.      * @Serializer\VirtualProperty
  3883.      *
  3884.      * @Serializer\Groups({"Rates"})
  3885.      *
  3886.      * @Serializer\SerializedName("negative_rates")
  3887.      *
  3888.      * @Serializer\Expose
  3889.      *
  3890.      * @return int
  3891.      */
  3892.     public function getNegativeRatesCount(?\DateTime $startDate null)
  3893.     {
  3894.         $criteria Criteria::create()
  3895.             ->where(Criteria::expr()->eq('rate'ListingRateConstant::UNSATISFYING));
  3896.         return $this->getRates($startDate)->matching($criteria)->count();
  3897.     }
  3898.     /**
  3899.      * @Serializer\VirtualProperty
  3900.      *
  3901.      * @Serializer\Groups({"Rates"})
  3902.      *
  3903.      * @Serializer\SerializedName("rates_reasons")
  3904.      *
  3905.      * @Serializer\Expose
  3906.      *
  3907.      * @return array
  3908.      */
  3909.     public function getRateReasonsCollection()
  3910.     {
  3911.         return $this->rateReasonsCollection;
  3912.     }
  3913.     /**
  3914.      * @return array
  3915.      */
  3916.     public function setRateReasonsCollection(array $rateReasonsCollection): self
  3917.     {
  3918.         $this->rateReasonsCollection = new ArrayCollection($rateReasonsCollection);
  3919.         return $this;
  3920.     }
  3921.     /**
  3922.      * @Serializer\VirtualProperty
  3923.      *
  3924.      * @Serializer\Groups({"Rates"})
  3925.      *
  3926.      * @Serializer\SerializedName("rates_comments")
  3927.      *
  3928.      * @Serializer\Expose
  3929.      *
  3930.      * @return array
  3931.      */
  3932.     public function getRatesComments()
  3933.     {
  3934.         $criteria Criteria::create()
  3935.             ->orderBy(['createdAt' => Criteria::DESC]);
  3936.         $comments = [];
  3937.         foreach ($this->getRates()->matching($criteria) as $rate) {
  3938.             $comments[] = $rate->getcomment();
  3939.         }
  3940.         return $comments;
  3941.     }
  3942.     public function getSynced()
  3943.     {
  3944.         return $this->synced;
  3945.     }
  3946.     /**
  3947.      * @return self
  3948.      */
  3949.     public function setSynced(bool $synced)
  3950.     {
  3951.         $this->synced $synced;
  3952.         return $this;
  3953.     }
  3954.     /**
  3955.      * @deprecated used to migrate to Skull service. Not needed anymore.
  3956.      *
  3957.      * @Serializer\VirtualProperty
  3958.      *
  3959.      * @Serializer\Groups({"Details", "Default", "ActivitiesData"})
  3960.      *
  3961.      * @Serializer\Expose
  3962.      */
  3963.     public function getReferenceId()
  3964.     {
  3965.         return $this->id;
  3966.     }
  3967.     /**
  3968.      * @param int $referenceId
  3969.      *
  3970.      * @return self
  3971.      */
  3972.     public function setReferenceId($referenceId)
  3973.     {
  3974.         $this->referenceId $referenceId;
  3975.         return $this;
  3976.     }
  3977.     public function setFeaturedTypeLabel($featuredTypeLabel): void
  3978.     {
  3979.         $this->featuredTypeLabel $featuredTypeLabel;
  3980.     }
  3981.     /**
  3982.      * @Serializer\VirtualProperty
  3983.      *
  3984.      * @Serializer\SerializedName("featuredType")
  3985.      *
  3986.      * @Serializer\Groups({"List", "Details", "listingDetails", "RelatedListingsV2"})
  3987.      *
  3988.      * @Serializer\Expose
  3989.      */
  3990.     public function getFeaturedType()
  3991.     {
  3992.         return ['type' => $this->getFeatured(), 'label' => $this->featuredTypeLabel];
  3993.     }
  3994.     /**
  3995.      * @Serializer\VirtualProperty
  3996.      *
  3997.      * @Serializer\SerializedName("featuredType")
  3998.      *
  3999.      * @Serializer\Groups({"DefaultV4", "SearchV4", "ProjectSearchV4", "locationListingV2", "MyListings"})
  4000.      */
  4001.     public function getFeaturedName()
  4002.     {
  4003.         return ListingFeaturedTypes::getFeaturedName($this->getFeatured());
  4004.     }
  4005.     /**
  4006.      * @Serializer\VirtualProperty
  4007.      *
  4008.      * @Serializer\SerializedName("referenceId")
  4009.      *
  4010.      * @Serializer\Expose()
  4011.      *
  4012.      * @Serializer\Groups({"DefaultV4", "SearchV4"})
  4013.      */
  4014.     public function getReferencedV4Id()
  4015.     {
  4016.         return $this->getId();
  4017.     }
  4018.     /**
  4019.      * @return favourite
  4020.      */
  4021.     public function getFavourite()
  4022.     {
  4023.         return $this->favourite;
  4024.     }
  4025.     public function setFavourite(array $favourites): self
  4026.     {
  4027.         foreach ($favourites as $favourite) {
  4028.             $this->addFavourite($favourites);
  4029.         }
  4030.         return $this;
  4031.     }
  4032.     /**
  4033.      * Add favourite.
  4034.      *
  4035.      * @return Listing
  4036.      */
  4037.     public function addFavourite(Favourite $favourite)
  4038.     {
  4039.         $favourite->setListing($this);
  4040.         $this->favourite[] = $favourite;
  4041.         return $this;
  4042.     }
  4043.     public function isPendingFeaturing()
  4044.     {
  4045.         return $this->isPendingFeaturing;
  4046.     }
  4047.     /**
  4048.      * @return $this
  4049.      */
  4050.     public function setPendingFeaturing($pendingFeaturing)
  4051.     {
  4052.         $this->isPendingFeaturing $pendingFeaturing;
  4053.         return $this;
  4054.     }
  4055.     public function getPendingFeaturingType()
  4056.     {
  4057.         return $this->pendingFeaturingType;
  4058.     }
  4059.     /**
  4060.      * @return Listing
  4061.      */
  4062.     public function setPendingFeaturingType($pendingFeaturingType)
  4063.     {
  4064.         $this->pendingFeaturingType $pendingFeaturingType;
  4065.         return $this;
  4066.     }
  4067.     /**
  4068.      * @Serializer\VirtualProperty
  4069.      *
  4070.      * @Serializer\SerializedName("is_favourite")
  4071.      *
  4072.      * @Serializer\Groups({"List", "Details"})
  4073.      *
  4074.      * @return bool
  4075.      */
  4076.     public function getIsFavourite()
  4077.     {
  4078.         return $this->isFavourite;
  4079.     }
  4080.     /**
  4081.      * @return Listing
  4082.      */
  4083.     public function setIsFavourite(bool $isFavourite)
  4084.     {
  4085.         $this->isFavourite $isFavourite;
  4086.         return $this;
  4087.     }
  4088.     /**
  4089.      * @Serializer\VirtualProperty
  4090.      *
  4091.      * @Serializer\SerializedName("user_note")
  4092.      *
  4093.      * @Serializer\Groups({"List", "Details"})
  4094.      *
  4095.      * @return string
  4096.      */
  4097.     public function getUserNote()
  4098.     {
  4099.         return $this->userNote;
  4100.     }
  4101.     /**
  4102.      * @return Listing
  4103.      */
  4104.     public function setUserNote(?string $userNote)
  4105.     {
  4106.         $this->userNote $userNote;
  4107.         return $this;
  4108.     }
  4109.     public function isProject(): bool
  4110.     {
  4111.         return ListingCategories::PROJECTS == $this->getCategory();
  4112.     }
  4113.     /**
  4114.      * @return int
  4115.      */
  4116.     public function getListingFeaturesFromFeaturedType()
  4117.     {
  4118.         switch ($this->getFeatured()) {
  4119.             case ListingFeaturedTypes::SPOTLIGHT:
  4120.                 return ListingFeatures::SPOTLIGHT;
  4121.             case ListingFeaturedTypes::SPONSORED:
  4122.                 return ListingFeatures::SPONSORED;
  4123.             case ListingFeaturedTypes::PREMIUM:
  4124.                 return ListingFeatures::PREMIUM;
  4125.             default:
  4126.                 return ListingFeatures::FEATURED;
  4127.         }
  4128.     }
  4129.     /**
  4130.      * @Serializer\VirtualProperty
  4131.      *
  4132.      * @Serializer\SerializedName("isExcludedFromWhatsApp")
  4133.      *
  4134.      * @Serializer\Groups({"List", "Details", "DefaultV4"})
  4135.      *
  4136.      * @return bool
  4137.      */
  4138.     public function getIsExcludedFromWhatsApp()
  4139.     {
  4140.         if (
  4141.             !empty($this->getUser()->getTeam())
  4142.             && TeamCategories::EXCLUDED_FROM_WHATSAPP == $this->getUser()->getTeam()->getCategory()
  4143.             && ListingCategories::PROJECTS == $this->getCategory()
  4144.         ) {
  4145.             return true;
  4146.         }
  4147.         return false;
  4148.     }
  4149.     /**
  4150.      * @return int|null
  4151.      */
  4152.     public function getRateStatus()
  4153.     {
  4154.         return $this->rateStatus;
  4155.     }
  4156.     /**
  4157.      * @return Listing
  4158.      */
  4159.     public function setRateStatus(?int $rateStatus)
  4160.     {
  4161.         $this->rateStatus $rateStatus;
  4162.         return $this;
  4163.     }
  4164.     /**
  4165.      * @Serializer\VirtualProperty
  4166.      *
  4167.      * @return string
  4168.      */
  4169.     public function getRateStatusLabel()
  4170.     {
  4171.         return ListingRateStatus::getLabel($this->getRateStatus());
  4172.     }
  4173.     /**
  4174.      * @return boolean||null
  4175.      */
  4176.     public function getIsRateReviewed()
  4177.     {
  4178.         return $this->isRateReviewed;
  4179.     }
  4180.     /**
  4181.      * @return Listing
  4182.      */
  4183.     public function setIsRateReviewed(?bool $isRateReviewed)
  4184.     {
  4185.         $this->isRateReviewed $isRateReviewed;
  4186.         return $this;
  4187.     }
  4188.     /**
  4189.      * @Serializer\VirtualProperty
  4190.      */
  4191.     public function getRateReviewStatusLabel(): string
  4192.     {
  4193.         return ListingRateReviewStatus::getLabel($this->getIsRateReviewed() ? ListingRateReviewStatus::REVIEWED ListingRateReviewStatus::PENDING_REVIEW);
  4194.     }
  4195.     /**
  4196.      * @Serializer\VirtualProperty
  4197.      *
  4198.      * @Serializer\Groups({"Rates"})
  4199.      *
  4200.      * @Serializer\SerializedName("reported_date")
  4201.      *
  4202.      * @Serializer\Expose
  4203.      *
  4204.      * @return array
  4205.      */
  4206.     public function getReportedDate()
  4207.     {
  4208.         return $this->reportedDate;
  4209.     }
  4210.     /**
  4211.      * @param \DateTime|string $reportedDate
  4212.      *
  4213.      * @return array
  4214.      */
  4215.     public function setReportedDate($reportedDate): self
  4216.     {
  4217.         $this->reportedDate $reportedDate;
  4218.         return $this;
  4219.     }
  4220.     /**
  4221.      * @return array
  4222.      */
  4223.     public function getReasonIds()
  4224.     {
  4225.         $rateReasonsCollection $this->getRateReasonsCollection();
  4226.         if (!isset($rateReasonsCollection['reason_ids'])) {
  4227.             return [];
  4228.         }
  4229.         $reasonsIds = [];
  4230.         foreach ($rateReasonsCollection['reason_ids'] as $key => $value) {
  4231.             $reasonsIds[] = [
  4232.                 'key' => $key,
  4233.                 'value' => $value,
  4234.             ];
  4235.         }
  4236.         return $reasonsIds;
  4237.     }
  4238.     /**
  4239.      * @return array
  4240.      */
  4241.     public function getReasonLabels()
  4242.     {
  4243.         $rateReasonsCollection $this->getRateReasonsCollection();
  4244.         if (!isset($rateReasonsCollection['reason_labels'])) {
  4245.             return [];
  4246.         }
  4247.         $reasonLabels = [];
  4248.         foreach ($rateReasonsCollection['reason_labels'] as $label => $count) {
  4249.             $reasonLabels[] = [
  4250.                 'label' => $label,
  4251.                 'count' => $count,
  4252.             ];
  4253.         }
  4254.         return $reasonLabels;
  4255.     }
  4256.     private function listMainListingPhonesFromUser(): ArrayCollection
  4257.     {
  4258.         $phones = new ArrayCollection();
  4259.         if ($this->getUser()) {
  4260.             foreach ($this->getUser()->getMainPhones(UserMainPhones::BUILD_FORMATTER_USER_PHONES) as $phone) {
  4261.                 if ($phone) {
  4262.                     $phones->add($this->castUserPhonesAsListingPhones($phone));
  4263.                 }
  4264.             }
  4265.         }
  4266.         return $phones;
  4267.     }
  4268.     private function castUserPhonesAsListingPhones(UserPhone $userPhone): ListingPhone
  4269.     {
  4270.         $phone $userPhone->getPhone();
  4271.         $phone->setWhatsApp($userPhone->isWhatsApp());
  4272.         return new ListingPhone(
  4273.             convert_arabic_numbers($phone->getNumber()),
  4274.             $this,
  4275.             $phone->getCountryCode(),
  4276.             $phone
  4277.         );
  4278.     }
  4279.     /**
  4280.      * @param Listing $parentOfSimilarListing
  4281.      *
  4282.      * @return Listing
  4283.      */
  4284.     public function setParentOfSimilarListing($parentOfSimilarListing)
  4285.     {
  4286.         $this->parentOfSimilarListing $parentOfSimilarListing;
  4287.         return $this;
  4288.     }
  4289.     /**
  4290.      * @Serializer\VirtualProperty
  4291.      *
  4292.      * @Serializer\SerializedName("parentOfSimilarListing")
  4293.      *
  4294.      * @Serializer\Groups({"SimilarListings"})
  4295.      *
  4296.      * @Serializer\Expose()
  4297.      *
  4298.      * @return Listing
  4299.      */
  4300.     public function getParentOfSimilarListing()
  4301.     {
  4302.         return $this->parentOfSimilarListing;
  4303.     }
  4304.     public function isCallRequest(): bool
  4305.     {
  4306.         return $this->isCallRequest;
  4307.     }
  4308.     public function setIsCallRequest(bool $isCallRequest): self
  4309.     {
  4310.         $this->isCallRequest $isCallRequest;
  4311.         return $this;
  4312.     }
  4313.     public function getNotMigratedFields()
  4314.     {
  4315.         return [
  4316.             'impressionUpdatedAt',
  4317.             'impressions',
  4318.         ];
  4319.     }
  4320.     public function generateCoordinates(): self
  4321.     {
  4322.         if ($this->getLocation() && (!$this->centerLat || !$this->centerLng)) {
  4323.             /** @var Location $location */
  4324.             $location $this->location;
  4325.             $this->setCenterLat($location->getLat());
  4326.             $this->setCenterLng($location->getLon());
  4327.         }
  4328.         return $this;
  4329.     }
  4330.     public function buildListingAttributes(): self
  4331.     {
  4332.         /** @var ListingAttribute $attribute */
  4333.         foreach ($this->attributes as $attribute) {
  4334.             if (!$attribute->getCustomField() instanceof CustomField) {
  4335.                 continue;
  4336.             }
  4337.             $attributeName $attribute->getFormattedAttributeName();
  4338.             $attributeValue $attribute->getValue();
  4339.             if (null != $attributeValue) {
  4340.                 $this->listingAttributes[$attributeName] = $attributeValue;
  4341.             }
  4342.             if (ListingCustomFields::FINISH_TYPE_VALUE == $attributeName) {
  4343.                 $this->listingAttributes[ListingCustomFields::FINISH_TYPE_LABEL_VALUE] = $attributeValue;
  4344.             }
  4345.         }
  4346.         return $this;
  4347.     }
  4348.     /**
  4349.      * @Serializer\VirtualProperty
  4350.      *
  4351.      * @Serializer\SerializedName("attributes")
  4352.      *
  4353.      * @Serializer\Groups({"DefaultV4", "SearchV4", "RelatedListingsV2", "MyListings"})
  4354.      *
  4355.      * @Serializer\Expose()
  4356.      *
  4357.      * @return array
  4358.      */
  4359.     public function getListingAttributesList()
  4360.     {
  4361.         if (empty($this->listingAttributes)) {
  4362.             return null;
  4363.         }
  4364.         return $this->listingAttributes;
  4365.     }
  4366.     /**
  4367.      * @return array
  4368.      */
  4369.     public function setListingAttributesList(array $attributesList)
  4370.     {
  4371.         $this->listingAttributes $attributesList;
  4372.         return $this->listingAttributes;
  4373.     }
  4374.     /**
  4375.      * @Serializer\VirtualProperty
  4376.      *
  4377.      * @Serializer\SerializedName("latitude")
  4378.      *
  4379.      * @Serializer\Groups({"DefaultV4", "SearchV4", "RelatedListingsV2"})
  4380.      *
  4381.      * @Serializer\Expose()
  4382.      *
  4383.      * @return float
  4384.      */
  4385.     public function getLatitude()
  4386.     {
  4387.         return $this->centerLat;
  4388.     }
  4389.     /**
  4390.      * @Serializer\VirtualProperty
  4391.      *
  4392.      * @Serializer\SerializedName("longitude")
  4393.      *
  4394.      * @Serializer\Groups({"DefaultV4", "SearchV4", "RelatedListingsV2"})
  4395.      *
  4396.      * @Serializer\Expose()
  4397.      *
  4398.      * @return float
  4399.      */
  4400.     public function getLongitude()
  4401.     {
  4402.         return $this->centerLng;
  4403.     }
  4404.     /**
  4405.      * @Serializer\VirtualProperty
  4406.      *
  4407.      * @Serializer\SerializedName("status")
  4408.      *
  4409.      * @Serializer\Groups({"DefaultV4", "MyListing", "MyListings"})
  4410.      *
  4411.      * @Serializer\Expose()
  4412.      *
  4413.      * @return string
  4414.      */
  4415.     public function getLabeledStatus()
  4416.     {
  4417.         return ListingStatus::getName($this->getStatus());
  4418.     }
  4419.     /**
  4420.      * @Serializer\SerializedName("propertyViewLabel")
  4421.      *
  4422.      * @Serializer\VirtualProperty()
  4423.      *
  4424.      * @Serializer\Groups({"DefaultV4","SearchV4"})
  4425.      *
  4426.      * @Serializer\Expose()
  4427.      */
  4428.     public function getTranslatedPropertyViewLabel()
  4429.     {
  4430.         return $this->propertyViewLabel;
  4431.     }
  4432.     /**
  4433.      * @Serializer\SerializedName("paymentMethodLabel")
  4434.      *
  4435.      * @Serializer\VirtualProperty()
  4436.      *
  4437.      * @Serializer\Groups({"DefaultV4"})
  4438.      *
  4439.      * @Serializer\Expose()
  4440.      */
  4441.     public function getTranslatedPaymentMethodLabel()
  4442.     {
  4443.         return $this->getPaymentMethodLabelTranslated();
  4444.     }
  4445.     /**
  4446.      * @Serializer\SerializedName("paymentMethod")
  4447.      *
  4448.      * @Serializer\VirtualProperty()
  4449.      *
  4450.      * @Serializer\Groups({"DefaultV4"})
  4451.      *
  4452.      * @Serializer\Expose()
  4453.      */
  4454.     public function getPaymentMethodText()
  4455.     {
  4456.         return ListingPaymentMethod::getText($this->paymentMethod);
  4457.     }
  4458.     /**
  4459.      * @Serializer\SerializedName("sellerRole")
  4460.      *
  4461.      * @Serializer\VirtualProperty()
  4462.      *
  4463.      * @Serializer\Groups({"Details", "DefaultV4", "SearchV4"})
  4464.      *
  4465.      * @Serializer\Expose()
  4466.      */
  4467.     public function getSellerRoleText()
  4468.     {
  4469.         return ListingSellerRoles::getName($this->getSellerRole());
  4470.     }
  4471.     public function generateAddress(): self
  4472.     {
  4473.         if ($this->address || !$this->location) {
  4474.             return $this;
  4475.         }
  4476.         $this->setAddress($this->getLocation()->getTitleFullPath());
  4477.         return $this;
  4478.     }
  4479.     public function setIsPriceNegotiable(bool $isPriceNegotiable, ?CustomField $isPriceNegotiableAttribute null): self
  4480.     {
  4481.         if (!$isPriceNegotiableAttribute) {
  4482.             return $this;
  4483.         }
  4484.         /** @var ListingAttribute $attribute */
  4485.         foreach ($this->attributes as $attribute) {
  4486.             if ($attribute->getCustomField()->getId() === $isPriceNegotiableAttribute->getId()) {
  4487.                 $attribute->setValue($isPriceNegotiable);
  4488.                 return $this;
  4489.             }
  4490.         }
  4491.         $listingAttribute = new ListingAttribute();
  4492.         $listingAttribute->setCustomField($isPriceNegotiableAttribute);
  4493.         $listingAttribute->setValue($isPriceNegotiable);
  4494.         $this->addAttribute($listingAttribute);
  4495.         return $this;
  4496.     }
  4497.     /**
  4498.      * @Serializer\SerializedName("isPriceNegotiable")
  4499.      *
  4500.      * @Serializer\VirtualProperty()
  4501.      *
  4502.      * @Serializer\Groups({"DefaultV4", "SearchV4"})
  4503.      *
  4504.      * @Serializer\Expose()
  4505.      */
  4506.     public function getIsPriceNegotiable(): bool
  4507.     {
  4508.         /** @var ListingAttribute $attribute */
  4509.         foreach ($this->attributes as $attribute) {
  4510.             if (ListingCustomFields::IS_NEGOTIABLE_NAME === $attribute->getCustomField()->getName()) {
  4511.                 return true;
  4512.             }
  4513.         }
  4514.         return false;
  4515.     }
  4516.     /**
  4517.      * @Serializer\VirtualProperty()
  4518.      *
  4519.      * @Serializer\Groups({"Statistics"})
  4520.      *
  4521.      * @Serializer\SerializedName("clickRate")
  4522.      *
  4523.      * @Serializer\Expose()
  4524.      */
  4525.     public function getClickRate(): float
  4526.     {
  4527.         $impressions $this->getImpressions() > $this->getImpressions() : 1;
  4528.         $views $this->getViews() > $this->getViews() : 1;
  4529.         return round(($views $impressions) * 1002);
  4530.     }
  4531.     /**
  4532.      * @return int|null
  4533.      *
  4534.      * @Serializer\VirtualProperty()
  4535.      *
  4536.      * @Serializer\Groups({"Statistics"})
  4537.      *
  4538.      * @Serializer\SerializedName("contactRate")
  4539.      *
  4540.      * @Serializer\Expose()
  4541.      *
  4542.      * @return float|int
  4543.      */
  4544.     public function getContactRate()
  4545.     {
  4546.         return ($this->getLeadsCounter() / ($this->getViewsCount() ?: 1)) * 100;
  4547.     }
  4548.     /**
  4549.      * @return float|int
  4550.      */
  4551.     public function getComputedContactRate()
  4552.     {
  4553.         if (empty($this->leadsCounter) || empty($this->views)) {
  4554.             return 0;
  4555.         }
  4556.         return round($this->leadsCounter $this->views 1002);
  4557.     }
  4558.     /**
  4559.      * @param float
  4560.      *
  4561.      * @return self
  4562.      */
  4563.     public function setContactRate(float $contactRate)
  4564.     {
  4565.         $this->contactRate $contactRate;
  4566.         return $this;
  4567.     }
  4568.     /**
  4569.      * @Serializer\VirtualProperty()
  4570.      *
  4571.      * @Serializer\Groups({"Statistics", "MyListing"})
  4572.      *
  4573.      * @Serializer\SerializedName("impressionsCount")
  4574.      *
  4575.      * @Serializer\Expose()
  4576.      *
  4577.      * @return float|int
  4578.      */
  4579.     public function getImpressionsCount()
  4580.     {
  4581.         return $this->getImpressions() ?: 0;
  4582.     }
  4583.     /**
  4584.      * @Serializer\VirtualProperty()
  4585.      *
  4586.      * @Serializer\Groups({"Statistics", "MyListing", "MyListings"})
  4587.      *
  4588.      * @Serializer\SerializedName("viewsCount")
  4589.      *
  4590.      * @Serializer\Expose()
  4591.      *
  4592.      * @return float|int
  4593.      */
  4594.     public function getViewsCount()
  4595.     {
  4596.         return $this->getViews() ?: 0;
  4597.     }
  4598.     /**
  4599.      * @Serializer\VirtualProperty()
  4600.      *
  4601.      * @Serializer\Groups({"Statistics", "MyListing", "MyListings"})
  4602.      *
  4603.      * @Serializer\SerializedName("leadsCount")
  4604.      *
  4605.      * @Serializer\Expose()
  4606.      *
  4607.      * @return float|int
  4608.      */
  4609.     public function getLeadCount()
  4610.     {
  4611.         return $this->getLeadsCounter() ?: 0;
  4612.     }
  4613.     /**
  4614.      * @return int|null
  4615.      */
  4616.     public function isCommercial()
  4617.     {
  4618.         return $this->isCommercial;
  4619.     }
  4620.     public function setIsCommercial(int $isCommercial): void
  4621.     {
  4622.         $this->isCommercial $isCommercial;
  4623.     }
  4624.     /**
  4625.      * @Serializer\VirtualProperty()
  4626.      *
  4627.      * @Serializer\Groups({"DefaultV4", "SearchV4"})
  4628.      *
  4629.      * @Serializer\SerializedName("category")
  4630.      *
  4631.      * @Serializer\Expose()
  4632.      *
  4633.      * @return string|null
  4634.      */
  4635.     public function getCategoryByName()
  4636.     {
  4637.         return ListingCategories::getLabel($this->getCategory());
  4638.     }
  4639.     /**
  4640.      * @Serializer\VirtualProperty()
  4641.      *
  4642.      * @Serializer\Groups({"Default", "Details", "listingDetails"})
  4643.      *
  4644.      * @Serializer\SerializedName("categoryLabel")
  4645.      *
  4646.      * @Serializer\Expose()
  4647.      */
  4648.     public function getCategoryLabel(): ?string
  4649.     {
  4650.         return $this->getCategoryName();
  4651.     }
  4652.     /**
  4653.      * @Serializer\VirtualProperty()
  4654.      *
  4655.      * @Serializer\Groups({"Statistics", "MyListing"})
  4656.      *
  4657.      * @Serializer\SerializedName("messagesCount")
  4658.      *
  4659.      * @Serializer\Expose()
  4660.      *
  4661.      * @return int|null
  4662.      */
  4663.     public function getMessagesCount()
  4664.     {
  4665.         return $this->getMessagesCounter() ?: 0;
  4666.     }
  4667.     /**
  4668.      * Get WhatsApp Number.
  4669.      *
  4670.      * @Serializer\VirtualProperty
  4671.      *
  4672.      * @Serializer\SerializedName("whatsAppNumber")
  4673.      *
  4674.      * @Serializer\Groups({"DefaultV4", "SearchV4", "ProjectDetailsV4", "ProjectSearchV4", "RelatedListingsV2", "locationListingV2", "listingDetails"})
  4675.      */
  4676.     public function getWhatsAppNumber()
  4677.     {
  4678.         $user $this->getUser();
  4679.         if ($user->getWhatsAppNumber()) {
  4680.             $whatsAppNumber $user->getWhatsAppNumber()->getNumber();
  4681.             if (!preg_match('/^\+\d+$/'$whatsAppNumber)) {
  4682.                 return $user->getCountryCode().$whatsAppNumber;
  4683.             }
  4684.             return $whatsAppNumber;
  4685.         }
  4686.         return null;
  4687.     }
  4688.     public function getTranslatableLocale()
  4689.     {
  4690.         return $this->locale;
  4691.     }
  4692.     /**
  4693.      * @return Listing
  4694.      */
  4695.     public function setV4Translations($translations)
  4696.     {
  4697.         $this->v4Translations $translations;
  4698.         return $this;
  4699.     }
  4700.     /**
  4701.      * Get translations.
  4702.      *
  4703.      * @Serializer\VirtualProperty
  4704.      *
  4705.      * @Serializer\Groups({"DefaultV4", "MyListing"})
  4706.      *
  4707.      * @Serializer\SerializedName("translations")
  4708.      *
  4709.      * @Serializer\Expose
  4710.      *
  4711.      * @return array
  4712.      */
  4713.     public function getV4Translations()
  4714.     {
  4715.         return $this->v4Translations;
  4716.     }
  4717.     /**
  4718.      * @Serializer\VirtualProperty
  4719.      *
  4720.      * @Serializer\Groups({"DefaultV4", "MyListing", "MyListings"})
  4721.      *
  4722.      * @Serializer\Expose
  4723.      *
  4724.      * @return ArrayCollection
  4725.      */
  4726.     public function getRejectionReasons()
  4727.     {
  4728.         return $this->rejections;
  4729.     }
  4730.     /**
  4731.      * @return array
  4732.      */
  4733.     public function getExistingTranslationsLanguages()
  4734.     {
  4735.         $existingLanguages = [];
  4736.         /** @var ListingTranslation $translation */
  4737.         foreach ($this->getTranslations() as $translation) {
  4738.             if ((!('title' == $translation->getField() || 'description' == $translation->getField()))
  4739.                 || \in_array($translation->getLocale(), $existingLanguages) || !$translation->getContent()
  4740.             ) {
  4741.                 continue;
  4742.             }
  4743.             $existingLanguages[] = $translation->getLocale();
  4744.         }
  4745.         return $existingLanguages;
  4746.     }
  4747.     public function isShownInHomepage(): bool
  4748.     {
  4749.         return $this->isShownInHomepage;
  4750.     }
  4751.     public function setIsShownInHomepage(bool $isShownInHomepage): self
  4752.     {
  4753.         $this->isShownInHomepage $isShownInHomepage;
  4754.         return $this;
  4755.     }
  4756.     public function isResale(): bool
  4757.     {
  4758.         return $this->isResale;
  4759.     }
  4760.     public function setIsResale(bool $isResale): self
  4761.     {
  4762.         $this->isResale $isResale;
  4763.         return $this;
  4764.     }
  4765.     public function setIsRent(bool $isRent): self
  4766.     {
  4767.         $this->isRent $isRent;
  4768.         return $this;
  4769.     }
  4770.     public function isRent(): bool
  4771.     {
  4772.         return $this->isRent;
  4773.     }
  4774.     public function setIsPrimary(bool $isPrimary): self
  4775.     {
  4776.         $this->isPrimary $isPrimary;
  4777.         return $this;
  4778.     }
  4779.     public function isPrimary(): bool
  4780.     {
  4781.         return $this->isPrimary;
  4782.     }
  4783.     /**
  4784.      * @return boolean||null
  4785.      */
  4786.     public function getIsMortgageApproved()
  4787.     {
  4788.         return $this->isMortgageApproved;
  4789.     }
  4790.     public function setIsMortgageApproved(?bool $isMortgageApproved): self
  4791.     {
  4792.         $this->isMortgageApproved $isMortgageApproved;
  4793.         return $this;
  4794.     }
  4795.     public function getRatesNotes()
  4796.     {
  4797.         return $this->ratesNotes;
  4798.     }
  4799.     public function getRatesNote()
  4800.     {
  4801.         if ($this->ratesNotes->isEmpty()) {
  4802.             return null;
  4803.         }
  4804.         return $this->ratesNotes->last();
  4805.     }
  4806.     public function setRatesNotes($ratesNotes): void
  4807.     {
  4808.         $this->ratesNotes $ratesNotes;
  4809.     }
  4810.     public function getMetaTitle(): ?string
  4811.     {
  4812.         return $this->metaTitle;
  4813.     }
  4814.     public function setMetaTitle(?string $metaTitle): self
  4815.     {
  4816.         $this->metaTitle $metaTitle;
  4817.         return $this;
  4818.     }
  4819.     public function getMetaDescription(): ?string
  4820.     {
  4821.         return $this->metaDescription;
  4822.     }
  4823.     public function setMetaDescription(?string $metaDescription): self
  4824.     {
  4825.         $this->metaDescription $metaDescription;
  4826.         return $this;
  4827.     }
  4828.     public function getIsMortgage(): bool
  4829.     {
  4830.         return $this->isMortgage;
  4831.     }
  4832.     public function setIsMortgage(bool $isMortgage): self
  4833.     {
  4834.         $this->isMortgage $isMortgage;
  4835.         return $this;
  4836.     }
  4837.     /**
  4838.      * @Serializer\VirtualProperty()
  4839.      *
  4840.      * @Serializer\SerializedName("compound_field")
  4841.      *
  4842.      * @Serializer\Groups({"Default", "DefaultV4","ProjectSearchV4", "ProjectDetailsV4", "locationListingV2", "homeCompoundV2"})
  4843.      *
  4844.      * @Serializer\Expose
  4845.      */
  4846.     public function getCompoundField(): ?CompoundField
  4847.     {
  4848.         $compoundField $this->compoundField;
  4849.         if ($this->hasParent()) {
  4850.             $compoundField $this->getParent()->getCompoundField();
  4851.         }
  4852.         return $compoundField;
  4853.     }
  4854.     public function setCompoundField(?CompoundField $compoundField): void
  4855.     {
  4856.         $this->compoundField $compoundField;
  4857.     }
  4858.     /**
  4859.      * @return array|null
  4860.      */
  4861.     public function getEligibleForMortgage()
  4862.     {
  4863.         return $this->eligibleForMortgage;
  4864.     }
  4865.     public function setEligibleForMortgage(?array $eligibleForMortgage null): self
  4866.     {
  4867.         $this->eligibleForMortgage $eligibleForMortgage;
  4868.         return $this;
  4869.     }
  4870.     public function setPropertyRegistrationStatusOptions(?array $propertyRegistrationStatusOptions null): self
  4871.     {
  4872.         $this->propertyRegistrationStatusOptions $propertyRegistrationStatusOptions;
  4873.         return $this;
  4874.     }
  4875.     /**
  4876.      * Get Mortgage Options.
  4877.      *
  4878.      * @return array|null
  4879.      *
  4880.      * @Serializer\VirtualProperty()
  4881.      *
  4882.      * @Serializer\Groups({"DefaultV4"})
  4883.      *
  4884.      * @Serializer\SerializedName("property_registration_status_options")
  4885.      *
  4886.      * @Serializer\Expose
  4887.      */
  4888.     public function getPropertyRegistrationStatusOptions()
  4889.     {
  4890.         return $this->propertyRegistrationStatusOptions;
  4891.     }
  4892.     /**
  4893.      * @return bool
  4894.      */
  4895.     public function hasPropertyRegistrationStatusOptions()
  4896.     {
  4897.         if (!$this->getSection() || !$this->getLocation()) {
  4898.             return false;
  4899.         }
  4900.         return $this->getLocation()->getEligibleForMortgage()
  4901.             && (ListingSections::FOR_SALE == $this->getSection()->getId());
  4902.     }
  4903.     /**
  4904.      * Get Eligible For Mortgage Data.
  4905.      *
  4906.      * @return array|null
  4907.      *
  4908.      * @Serializer\VirtualProperty()
  4909.      *
  4910.      * @Serializer\Groups({"DefaultV4", "SearchV4", "Default", "listingDetails"})
  4911.      *
  4912.      * @Serializer\SerializedName("eligibleForMortgageData")
  4913.      *
  4914.      * @Serializer\Expose
  4915.      */
  4916.     public function getEligibleForMortgageData()
  4917.     {
  4918.         return $this->eligibleForMortgageData;
  4919.     }
  4920.     public function setEligibleForMortgageData(?array $eligibleForMortgageData null): self
  4921.     {
  4922.         $this->eligibleForMortgageData $eligibleForMortgageData;
  4923.         return $this;
  4924.     }
  4925.     /**
  4926.      * Get Eligible For Mortgage with Label.
  4927.      *
  4928.      * @return array
  4929.      */
  4930.     public function getEligibleForMortgageWithLabel()
  4931.     {
  4932.         $eligibleForMortgageWithLabel = [];
  4933.         if (!empty($this->getEligibleForMortgage())) {
  4934.             foreach ($this->getEligibleForMortgage() as $mortgage) {
  4935.                 $eligibleForMortgageWithLabel[] = [
  4936.                     'id' => $mortgage,
  4937.                     'title' => EligibleForMortgageData::getLabel($mortgage),
  4938.                 ];
  4939.             }
  4940.         }
  4941.         return $eligibleForMortgageWithLabel;
  4942.     }
  4943.     /**
  4944.      * @return PropertyTypeChildren
  4945.      */
  4946.     public function setPropertyTypeChildren($propertyTypeChilden)
  4947.     {
  4948.         $this->propertyTypeChilden $propertyTypeChilden;
  4949.         return $this;
  4950.     }
  4951.     /**
  4952.      * Get PropertyTypeChildren.
  4953.      *
  4954.      * @return array
  4955.      */
  4956.     public function getPropertyTypeChildren()
  4957.     {
  4958.         return $this->propertyTypeChilden;
  4959.     }
  4960.     /**
  4961.      * @return float
  4962.      */
  4963.     public function getCompoundElasticScore()
  4964.     {
  4965.         return $this->compoundElasticScore;
  4966.     }
  4967.     /**
  4968.      * @param float $compoundElasticScore
  4969.      *
  4970.      * @return Listing
  4971.      */
  4972.     public function setCompoundElasticScore($compoundElasticScore)
  4973.     {
  4974.         $this->compoundElasticScore $compoundElasticScore;
  4975.         return $this;
  4976.     }
  4977.     /**.
  4978.      * @return int|null
  4979.      */
  4980.     public function getPropertyRegistrationStatus()
  4981.     {
  4982.         return $this->propertyRegistrationStatus;
  4983.     }
  4984.     public function setPropertyRegistrationStatus(?int $propertyRegistrationStatus): self
  4985.     {
  4986.         $this->propertyRegistrationStatus $propertyRegistrationStatus;
  4987.         return $this;
  4988.     }
  4989.     /**
  4990.      * Get property registration status data options.
  4991.      *
  4992.      * @return array|null
  4993.      *
  4994.      * @Serializer\VirtualProperty()
  4995.      *
  4996.      * @Serializer\Groups({"List", "Details", "Search", "DefaultV4", "SearchV4"})
  4997.      *
  4998.      * @Serializer\SerializedName("property_registration_status_data")
  4999.      *
  5000.      * @Serializer\Expose
  5001.      */
  5002.     public function getPropertyRegistrationStatusData()
  5003.     {
  5004.         if (empty($this->propertyRegistrationStatus)) {
  5005.             return null;
  5006.         }
  5007.         return [
  5008.             'id' => $this->propertyRegistrationStatus,
  5009.             'title' => PropertyRegistrationStatusOption::getLabel($this->propertyRegistrationStatus),
  5010.         ];
  5011.     }
  5012.     /**
  5013.      * @Serializer\VirtualProperty()
  5014.      *
  5015.      * @Serializer\Groups({"Details", "DefaultV4","SearchV4"})
  5016.      *
  5017.      * @Serializer\SerializedName("financialAidURL")
  5018.      *
  5019.      * @Serializer\Expose
  5020.      */
  5021.     public function getFinancialAidURL(): ?string
  5022.     {
  5023.         return FinancialAidURL::getUrl($this->financialAid$this->getId());
  5024.     }
  5025.     public function setFinancialAid(FinancialAid $financialAid): void
  5026.     {
  5027.         $this->financialAid $financialAid;
  5028.     }
  5029.     /**
  5030.      * @return bool
  5031.      */
  5032.     public function isExcludedFromClientServed()
  5033.     {
  5034.         $user $this->getUser();
  5035.         if ($user && $user->hasRole('ROLE_HOME_EG')) {
  5036.             return true;
  5037.         }
  5038.         return false;
  5039.     }
  5040.     /**
  5041.      * @Serializer\VirtualProperty()
  5042.      *
  5043.      * @Serializer\Groups({"Details", "DefaultV4","SearchV4"})
  5044.      *
  5045.      * @Serializer\SerializedName("hasSimilarListings")
  5046.      *
  5047.      * @Serializer\Expose
  5048.      */
  5049.     public function hasSimilarListings(): bool
  5050.     {
  5051.         return !empty($this->getSimilarListingsCount());
  5052.     }
  5053.     /**
  5054.      * @Serializer\VirtualProperty()
  5055.      *
  5056.      * @Serializer\Groups({"Details", "DefaultV4","SearchV4"})
  5057.      *
  5058.      * @Serializer\SerializedName("similarListingsCount")
  5059.      *
  5060.      * @Serializer\Expose
  5061.      */
  5062.     public function getSimilarListingsCount(): int
  5063.     {
  5064.         return $this->similarListingsCount;
  5065.     }
  5066.     public function setSimilarListingsCount(int $count): self
  5067.     {
  5068.         $this->similarListingsCount $count;
  5069.         return $this;
  5070.     }
  5071.     /**
  5072.      * Set similar listings ids.
  5073.      */
  5074.     public function setSimilarListingsIds(array $arrayOfIds): self
  5075.     {
  5076.         $this->similarListingsIds $arrayOfIds;
  5077.         return $this;
  5078.     }
  5079.     /**
  5080.      * @Serializer\VirtualProperty()
  5081.      *
  5082.      * @Serializer\Groups({"Details", "DefaultV4","SearchV4"})
  5083.      *
  5084.      * @Serializer\SerializedName("similarListingsIds")
  5085.      *
  5086.      * @Serializer\Expose
  5087.      */
  5088.     public function getSimilarListingsIds(): array
  5089.     {
  5090.         return $this->similarListingsIds;
  5091.     }
  5092.     public function getAdvertiserNumber(): ?string
  5093.     {
  5094.         return $this->advertiserNumber;
  5095.     }
  5096.     public function setAdvertiserNumber(?string $advertiserNumber): void
  5097.     {
  5098.         $this->advertiserNumber $advertiserNumber;
  5099.     }
  5100.     public function getAuthorizationNumber(): ?string
  5101.     {
  5102.         return $this->authorizationNumber;
  5103.     }
  5104.     public function setAuthorizationNumber(?string $authorizationNumber): void
  5105.     {
  5106.         $this->authorizationNumber $authorizationNumber;
  5107.     }
  5108.     /**
  5109.      * Get the value of marketPropertyType.
  5110.      *
  5111.      * @return int|null
  5112.      */
  5113.     public function getMarketPropertyType()
  5114.     {
  5115.         return $this->marketPropertyType;
  5116.     }
  5117.     /**
  5118.      * Set the value of marketPropertyType.
  5119.      *
  5120.      * @return self
  5121.      */
  5122.     public function setMarketPropertyType(?int $marketPropertyType)
  5123.     {
  5124.         $this->marketPropertyType $marketPropertyType;
  5125.         return $this;
  5126.     }
  5127.     /**
  5128.      * Get the value of creationSource.
  5129.      *
  5130.      * @return int
  5131.      */
  5132.     public function getCreationSource()
  5133.     {
  5134.         return $this->creationSource;
  5135.     }
  5136.     /**
  5137.      * Set the value of creationSource.
  5138.      *
  5139.      * @return self
  5140.      */
  5141.     public function setCreationSource(int $creationSource)
  5142.     {
  5143.         $this->creationSource $creationSource;
  5144.         return $this;
  5145.     }
  5146.     /**
  5147.      * @return float
  5148.      *
  5149.      * @Serializer\VirtualProperty()
  5150.      *
  5151.      * @Serializer\Groups({"Statistics"})
  5152.      *
  5153.      * @Serializer\SerializedName("costPerLead")
  5154.      *
  5155.      * @Serializer\Expose
  5156.      */
  5157.     public function getCostPerLead()
  5158.     {
  5159.         return $this->costPerLead;
  5160.     }
  5161.     /**
  5162.      * Set the value of costPerLead.
  5163.      *
  5164.      * @return self
  5165.      */
  5166.     public function setCostPerLead(float $costPerLead)
  5167.     {
  5168.         $this->costPerLead $costPerLead;
  5169.         return $this;
  5170.     }
  5171.     /**
  5172.      * Get the value of resaleCount.
  5173.      *
  5174.      * @return int
  5175.      */
  5176.     public function getResaleCount()
  5177.     {
  5178.         return $this->resaleCount;
  5179.     }
  5180.     /**
  5181.      * Set the value of resaleCount.
  5182.      *
  5183.      * @return self
  5184.      */
  5185.     public function setResaleCount(int $resaleCount)
  5186.     {
  5187.         $this->resaleCount $resaleCount;
  5188.         return $this;
  5189.     }
  5190.     /**
  5191.      * Get the value of resaleCount.
  5192.      *
  5193.      * @return int
  5194.      */
  5195.     public function getRentCount()
  5196.     {
  5197.         return $this->rentCount;
  5198.     }
  5199.     /**
  5200.      * Set the value of rentCount.
  5201.      *
  5202.      * @return self
  5203.      */
  5204.     public function setRentCount(int $rentCount)
  5205.     {
  5206.         $this->rentCount $rentCount;
  5207.         return $this;
  5208.     }
  5209.     /**
  5210.      * Get the value of clickThroughRate.
  5211.      */
  5212.     public function getClickThroughRate(): float
  5213.     {
  5214.         return $this->getClickRate();
  5215.     }
  5216.     /**
  5217.      * Set the value of clickThroughRate.
  5218.      */
  5219.     public function setClickThroughRate(float $clickThroughRate): self
  5220.     {
  5221.         $this->clickThroughRate $clickThroughRate;
  5222.         return $this;
  5223.     }
  5224.     /**
  5225.      * Get the value of label.
  5226.      *
  5227.      * @return int
  5228.      */
  5229.     public function getLabel()
  5230.     {
  5231.         return $this->label;
  5232.     }
  5233.     /**
  5234.      * Set the value of label.
  5235.      *
  5236.      * @return self
  5237.      */
  5238.     public function setLabel($label)
  5239.     {
  5240.         $this->label $label;
  5241.         return $this;
  5242.     }
  5243.     /**
  5244.      * Get the value of isTopPicks.
  5245.      */
  5246.     public function getIsTopPicks()
  5247.     {
  5248.         return $this->isTopPicks;
  5249.     }
  5250.     /**
  5251.      * Set the value of isTopPicks.
  5252.      *
  5253.      * @return self
  5254.      */
  5255.     public function setIsTopPicks($isTopPicks)
  5256.     {
  5257.         $this->isTopPicks $isTopPicks;
  5258.         return $this;
  5259.     }
  5260.     /**
  5261.      * Get freezedAt date.
  5262.      *
  5263.      * @return \DateTime
  5264.      */
  5265.     public function getFreezedAt()
  5266.     {
  5267.         return $this->freezedAt;
  5268.     }
  5269.     /**
  5270.      * Set freezedAt date.
  5271.      *
  5272.      * @return Listing
  5273.      */
  5274.     public function setFreezedAt($freezedAt)
  5275.     {
  5276.         $this->freezedAt $freezedAt;
  5277.         return $this;
  5278.     }
  5279.     public function getEligibleForBumpUp(): bool
  5280.     {
  5281.         return $this->eligibleForBumpUp;
  5282.     }
  5283.     public function setEligibleForBumpUp(bool $eligibleForBumpUp): self
  5284.     {
  5285.         $this->eligibleForBumpUp $eligibleForBumpUp;
  5286.         return $this;
  5287.     }
  5288.     /**
  5289.      * Get waiting time.
  5290.      *
  5291.      * @return string
  5292.      */
  5293.     public function getWaitingTime()
  5294.     {
  5295.         return $this->waitingTime;
  5296.     }
  5297.     /**
  5298.      * Set waiting time.
  5299.      *
  5300.      * @param string $waitingTime
  5301.      *
  5302.      * @return Listing
  5303.      */
  5304.     public function setWaitingTime($waitingTime)
  5305.     {
  5306.         $this->waitingTime $waitingTime;
  5307.         return $this;
  5308.     }
  5309.     /**
  5310.      * Get reference number.
  5311.      */
  5312.     public function getReferenceNumber(): ?string
  5313.     {
  5314.         return $this->referenceNumber;
  5315.     }
  5316.     /**
  5317.      * Set reference number.
  5318.      *
  5319.      * @param string $referenceNumber
  5320.      */
  5321.     public function setReferenceNumber($referenceNumber): self
  5322.     {
  5323.         $this->referenceNumber $referenceNumber;
  5324.         return $this;
  5325.     }
  5326. }