<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 3:08 PM
*/
namespace App\AppBundle\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity(repositoryClass="App\AppBundle\MainBundle\Repository\PS_Add_SpotRepository")
* @ORM\Table(name="ps_add_spot")
* @ORM\HasLifecycleCallbacks()
*/
class PS_Add_Spot implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* Many Token have one user. This is the owning side.
* @ORM\ManyToOne(targetEntity="User", inversedBy="add_spot")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_validated = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_requested_for_validation = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_requested_for_verification = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_completed = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_verified = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $loc_detail = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $photos = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $streetview = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $pricing = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $special_days = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $availability = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_saved = false;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 1})
*/
private $is_active = true;//This is used to disable the spot.
/**
* One Product has One Shipment.
* @ORM\OneToOne(targetEntity="PS_Add_Spot_Loc_Detail")
* @ORM\JoinColumn(name="ps_add_spot_loc_detail_id", referencedColumnName="id")
*/
private $ps_add_spot_loc_detail;
/**
* One Product has One Shipment.
* @ORM\OneToOne(targetEntity="PS_Add_Spot_Street_View")
* @ORM\JoinColumn(name="ps_add_spot_street_view_id", referencedColumnName="id")
*/
private $ps_add_spot_street_view;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="PS_Add_Spot_Photos", mappedBy="ps_add_spot")
*/
private $ps_add_spot_photos;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="PS_Add_Spot_Availability", mappedBy="ps_add_spot")
*/
private $ps_add_spot_availability;
/**
* One Product has One Shipment.
* @ORM\OneToOne(targetEntity="PS_Add_Spot_Pricing")
* @ORM\JoinColumn(name="ps_add_spot_pricing_id", referencedColumnName="id")
*/
private $ps_add_spot_pricing;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="PS_Add_Spot_Special_Days", mappedBy="ps_add_spot")
*/
private $ps_add_spot_special_days;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="PS_Add_Spot_UnAvailability", mappedBy="ps_add_spot")
*/
private $ps_add_spot_unavailability;
/**
* @ORM\ManyToOne(targetEntity="WP_Currency")
* @ORM\JoinColumn(name="wp_currency_id", referencedColumnName="id")
*/
private $wp_currency;
/**
* @ORM\OneToOne(targetEntity="PS_My_Spots", mappedBy="ps_add_spot")
*/
private $ps_my_spot;
/**
* @ORM\Column(type="integer", nullable=true, options={"default" : 0})
*/
private $spot_status;//1-Active, 2-TemporarilyUserDisabled, 3-AdminTemporarilyDisabled, 4-PermanentlyDisabled, 5-Deleted, 6-Incomplete
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="Orders", mappedBy="user")
*/
private $orders;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="User_Spot_Reviews", mappedBy="ps_add_spot")
*/
private $user_spot_reviews;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="Supplier_To_User_Ratings", mappedBy="ps_add_spot")
*/
private $supplier_to_user_ratings;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $spot_activated_on;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $spot_verified_on;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $spot_deactivated_on;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $spot_deleted_on;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reason;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reason_validation;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reason_verification;
/**
* @var WP_Pricing_Data
* @ORM\ManyToOne(targetEntity="WP_Pricing_Data")
* @ORM\JoinColumn(name="default_pricing_data_id", referencedColumnName="id", nullable=true)
*/
private $default_pricing_data;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getisCompleted()
{
return $this->is_completed;
}
/**
* @param mixed $is_completed
*/
public function setIsCompleted($is_completed)
{
$this->is_completed = $is_completed;
}
/**
* @return mixed
*/
public function getSpotStatus()
{
return $this->spot_status;
}
/**
* @param mixed $spot_status
*/
public function setSpotStatus($spot_status)
{
$this->spot_status = $spot_status;
}
/**
* @return mixed
*/
public function getisVerified()
{
return $this->is_verified;
}
/**
* @param mixed $is_verified
*/
public function setIsVerified($is_verified)
{
$this->is_verified = $is_verified;
}
/**
* @return mixed
*/
public function getLocDetail()
{
return $this->loc_detail;
}
/**
* @param mixed $loc_detail
*/
public function setLocDetail($loc_detail)
{
$this->loc_detail = $loc_detail;
}
/**
* @return mixed
*/
public function getPhotos()
{
return $this->photos;
}
/**
* @param mixed $photos
*/
public function setPhotos($photos)
{
$this->photos = $photos;
}
/**
* @return mixed
*/
public function getStreetview()
{
return $this->streetview;
}
/**
* @param mixed $streetview
*/
public function setStreetview($streetview)
{
$this->streetview = $streetview;
}
/**
* @return mixed
*/
public function getPricing()
{
return $this->pricing;
}
/**
* @param mixed $pricing
*/
public function setPricing($pricing)
{
$this->pricing = $pricing;
}
/**
* @return mixed
*/
public function getSpecialDays()
{
return $this->special_days;
}
/**
* @param mixed $special_days
*/
public function setSpecialDays($special_days)
{
$this->special_days = $special_days;
}
/**
* @return mixed
*/
public function getAvailability()
{
return $this->availability;
}
/**
* @param mixed $availability
*/
public function setAvailability($availability)
{
$this->availability = $availability;
}
/**
* @return PS_Add_Spot_Loc_Detail
*/
public function getPsAddSpotLocDetail()
{
return $this->ps_add_spot_loc_detail;
}
/**
* @param mixed $ps_add_spot_loc_detail
*/
public function setPsAddSpotLocDetail($ps_add_spot_loc_detail)
{
$this->ps_add_spot_loc_detail = $ps_add_spot_loc_detail;
}
/**
* @return mixed
*/
public function getPsAddSpotStreetView()
{
return $this->ps_add_spot_street_view;
}
/**
* @param mixed $ps_add_spot_street_view
*/
public function setPsAddSpotStreetView($ps_add_spot_street_view)
{
$this->ps_add_spot_street_view = $ps_add_spot_street_view;
}
/**
* @return mixed
*/
public function getPsAddSpotPhotos()
{
return $this->ps_add_spot_photos;
}
/**
* @return PS_Add_Spot_Photos
*/
public function getPsAddSpotDefaultImage() {
$criteria = Criteria::create();
$criteria->orderBy(array('seq_number' => Criteria::ASC))
->setMaxResults(1);
$result = $this->ps_add_spot_photos->matching($criteria);
if (count($result) > 0) {
return $result[0];
}
return $result;
}
/**
* @param mixed $ps_add_spot_photos
*/
public function setPsAddSpotPhotos($ps_add_spot_photos)
{
$this->ps_add_spot_photos = $ps_add_spot_photos;
}
/**
* @return mixed
*/
public function getPsAddSpotAvailability()
{
return $this->ps_add_spot_availability;
}
/**
* @param mixed $ps_add_spot_availability
*/
public function setPsAddSpotAvailability($ps_add_spot_availability)
{
$this->ps_add_spot_availability = $ps_add_spot_availability;
}
/**
* @return PS_Add_Spot_Pricing
*/
public function getPsAddSpotPricing()
{
return $this->ps_add_spot_pricing;
}
/**
* @param mixed $ps_add_spot_pricing
*/
public function setPsAddSpotPricing($ps_add_spot_pricing)
{
$this->ps_add_spot_pricing = $ps_add_spot_pricing;
}
/**
* @return mixed
*/
public function getPsAddSpotSpecialDays()
{
return $this->ps_add_spot_special_days;
}
/**
* @param mixed $ps_add_spot_special_days
*/
public function setPsAddSpotSpecialDays($ps_add_spot_special_days)
{
$this->ps_add_spot_special_days = $ps_add_spot_special_days;
}
/**
* @return mixed
*/
public function getPsAddSpotUnavailability()
{
return $this->ps_add_spot_unavailability;
}
/**
* @param mixed $ps_add_spot_unavailability
*/
public function setPsAddSpotUnavailability($ps_add_spot_unavailability)
{
$this->ps_add_spot_unavailability = $ps_add_spot_unavailability;
}
/**
* @return WP_Currency
*/
public function getWpCurrency()
{
return $this->wp_currency;
}
/**
* @param mixed $wp_currency
*/
public function setWpCurrency($wp_currency)
{
$this->wp_currency = $wp_currency;
}
/**
* @return mixed
*/
public function getIsSaved()
{
return $this->is_saved;
}
/**
* @param mixed $is_saved
*/
public function setIsSaved($is_saved)
{
$this->is_saved = $is_saved;
}
/**
* @return PS_My_Spots
*/
public function getPsMySpot()
{
return $this->ps_my_spot;
}
/**
* @param mixed $ps_my_spot
*/
public function setPsMySpot($ps_my_spot)
{
$this->ps_my_spot = $ps_my_spot;
}
/**
* @return mixed
*/
public function getIsActive()
{
return $this->is_active;
}
/**
* @param mixed $is_active
*/
public function setIsActive($is_active)
{
$this->is_active = $is_active;
}
/**
* @return mixed
*/
public function getOrders()
{
return $this->orders;
}
/**
* @param mixed $orders
*/
public function setOrders($orders)
{
$this->orders = $orders;
}
/**
* @return mixed
*/
public function getUserSpotReviews()
{
return $this->user_spot_reviews;
}
/**
* @param mixed $user_spot_reviews
*/
public function setUserSpotReviews($user_spot_reviews)
{
$this->user_spot_reviews = $user_spot_reviews;
}
/**
* @return mixed
*/
public function getSupplierToUserRatings()
{
return $this->supplier_to_user_ratings;
}
/**
* @param mixed $supplier_to_user_ratings
*/
public function setSupplierToUserRatings($supplier_to_user_ratings)
{
$this->supplier_to_user_ratings = $supplier_to_user_ratings;
}
/**
* @return mixed
*/
public function getSpotActivatedOn()
{
return $this->spot_activated_on;
}
/**
* @param mixed $spot_activated_on
*/
public function setSpotActivatedOn($spot_activated_on)
{
$this->spot_activated_on = $spot_activated_on;
}
/**
* @return mixed
*/
public function getSpotVerifiedOn()
{
return $this->spot_verified_on;
}
/**
* @param mixed $spot_verified_on
*/
public function setSpotVerifiedOn($spot_verified_on)
{
$this->spot_verified_on = $spot_verified_on;
}
/**
* @return mixed
*/
public function getSpotDeactivatedOn()
{
return $this->spot_deactivated_on;
}
/**
* @param mixed $spot_deactivated_on
*/
public function setSpotDeactivatedOn($spot_deactivated_on)
{
$this->spot_deactivated_on = $spot_deactivated_on;
}
/**
* @return mixed
*/
public function getSpotDeletedOn()
{
return $this->spot_deleted_on;
}
/**
* @param mixed $spot_deleted_on
*/
public function setSpotDeletedOn($spot_deleted_on)
{
$this->spot_deleted_on = $spot_deleted_on;
}
/**
* @return mixed
*/
public function getReason()
{
return $this->reason;
}
/**
* @param mixed $reason
*/
public function setReason($reason)
{
$this->reason = $reason;
}
/**
* @return mixed
*/
public function getIsValidated()
{
return $this->is_validated;
}
/**
* @param mixed $is_validated
*/
public function setIsValidated($is_validated)
{
$this->is_validated = $is_validated;
}
/**
* @return mixed
*/
public function getIsRequestedForVerification()
{
return $this->is_requested_for_verification;
}
/**
* @param mixed $is_requested_for_verification
*/
public function setIsRequestedForVerification($is_requested_for_verification)
{
$this->is_requested_for_verification = $is_requested_for_verification;
}
/**
* @return mixed
*/
public function getIsRequestedForValidation()
{
return $this->is_requested_for_validation;
}
/**
* @param mixed $is_requested_for_validation
*/
public function setIsRequestedForValidation($is_requested_for_validation)
{
$this->is_requested_for_validation = $is_requested_for_validation;
}
/**
* @return mixed
*/
public function getReasonValidation()
{
return $this->reason_validation;
}
/**
* @param mixed $reason_validation
*/
public function setReasonValidation($reason_validation)
{
$this->reason_validation = $reason_validation;
}
/**
* @return mixed
*/
public function getReasonVerification()
{
return $this->reason_verification;
}
/**
* @param mixed $reason_verification
*/
public function setReasonVerification($reason_verification)
{
$this->reason_verification = $reason_verification;
}
/**
* @return WP_Pricing_Data
*/
public function getDefaultPricingData()
{
return $this->default_pricing_data;
}
/**
* @param WP_Pricing_Data $default_pricing_data
*/
public function setDefaultPricingData(WP_Pricing_Data $default_pricing_data)
{
$this->default_pricing_data = $default_pricing_data;
}
/**
* @return PS_Add_Spot_Photos
*/
public function getDefaultSpotImageObject() {
$criteria = Criteria::create();
$criteria->orderBy(['seq_number' => Criteria::ASC])
->setMaxResults(1);
$photos = $this->ps_add_spot_photos->matching($criteria);
if (count($photos) > 0) {
return $photos[0];
}
return NULL;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
);
}
/**
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @var string $created
*
* @ORM\Column(name="created_at", type="string", nullable=false)
*/
protected $createdAt;
/**
* @var string $updated
*
* @ORM\Column(name="updated_at", type="string", nullable=false)
*/
protected $updatedAt;
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps()
{
$this->setUpdatedAt(round(microtime(true) * 1000));
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(round(microtime(true) * 1000));
}
}
public function __construct() {
$this->ps_add_spot_photos = new ArrayCollection();
$this->ps_add_spot_special_days = new ArrayCollection();
$this->ps_add_spot_unavailability = new ArrayCollection();
$this->ps_add_spot_availability = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->supplier_to_user_ratings = new ArrayCollection();
$this->user_spot_reviews = new ArrayCollection();
$this->setCreatedAt(round(microtime(true) * 1000));
}
}