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

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