<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 30/10/18
* Time: 11:35 AM
*/
namespace App\AppBundle\MainBundle\Entity;
use App\AppBundle\MainBundle\Constants\SpotStatus;
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\UserRepository")
* @ORM\Table(name="user")
* @ORM\HasLifecycleCallbacks()
*/
class User implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var User_Stripe_Details
* @ORM\OneToOne(targetEntity="User_Stripe_Details", mappedBy="user")
*/
private $user_stripe_details;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $first_name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $last_name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $email;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $mobile;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $password;
/**
* @ORM\Column(type="integer", nullable=false)
* @Assert\NotBlank()
*/
private $login_type = 0;//0 - Default, 1 - Facebook, 2 - Google, 3 - Apple
/**
* @ORM\Column(type="integer", nullable=false)
* @Assert\NotBlank()
*/
private $pu_login_process_steps = 0;//0-Select Roles, 1 - Profile Screen, 2 - Add Vehicle, 3 - Add Payment Methods, 4 - Parking User Home
/**
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $is_mobile_verified = false;
/**
* @ORM\Column(type="integer", nullable=false)
* @Assert\NotBlank()
*/
private $active_user_role = 1;//0 - Not Yet Set, 1 - Park User, 2 - Park Supplier
/**
* @var \DateTime
* @ORM\Column(type="date", nullable=true)
*/
private $dob;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $gender;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $is_profile_complete = false;
/**
* @var string
* @ORM\Column(type="string", nullable=true)
*/
private $password_change_date;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reset_code;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reset_code_start_timestamp;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reset_password_token;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $country_code;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $profile_pic_url;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $social_profile_id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $social_media_profile_pic_url;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $invite_code;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
*/
private $is_new_user;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
*/
private $is_active;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="Token", mappedBy="user")
*/
private $tokens;
/**
* @var WP_TimeZone
* @ORM\ManyToOne(targetEntity="WP_TimeZone")
* @ORM\JoinColumn(name="timezone_id", referencedColumnName="id")
*/
private $timezone;
/**
* @var WP_Time_Format
* @ORM\ManyToOne(targetEntity="WP_Time_Format")
* @ORM\JoinColumn(name="time_format_id", referencedColumnName="id")
*/
private $time_format;
/**
* @var WP_Date_Format
* @ORM\ManyToOne(targetEntity="WP_Date_Format")
* @ORM\JoinColumn(name="date_format_id", referencedColumnName="id")
*/
private $date_format;
/**
* @var WP_Currency
* @ORM\ManyToOne(targetEntity="WP_Currency")
* @ORM\JoinColumn(name="currency_id", referencedColumnName="id")
*/
private $currency;
/**
* @var WP_Language
* @ORM\ManyToOne(targetEntity="WP_Language")
* @ORM\JoinColumn(name="language_id", referencedColumnName="id")
*/
private $language;
/**
* @ORM\OneToOne(targetEntity="PU_ManageNotifications", mappedBy="user")
*/
private $manage_notifications;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="PU_Vehicles", mappedBy="user")
*/
private $vehicles;
/**
* @ORM\OneToMany(targetEntity="PS_Add_Spot", mappedBy="user")
*/
private $add_spot;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="PU_Fav_Spots", mappedBy="user")
*/
private $fav_spot;
/**
* 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="Supplier_To_User_Ratings", mappedBy="user")
*/
private $supplier_to_user_ratings;
/**
* One user has many tokens. This is the inverse side.
* @ORM\OneToMany(targetEntity="User_Spot_Reviews", mappedBy="user")
*/
private $user_spot_reviews;
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=false)
*/
private $last_active_date;
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=false)
*/
private $user_register_date;
/**
* @var WP_Distance
* @ORM\ManyToOne(targetEntity="WP_Distance")
* @ORM\JoinColumn(name="distance_id", referencedColumnName="id")
*/
private $distance;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_unsubscribed_to_email = false;
private $is_seeker;
private $is_provider;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $deactivate_status;//0 - Active, 1 - User Deactivate, 2 - Admin Deactivate, 3 - Reported By User To Deactivate
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=true)
*/
private $deactivate_user_date;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $activate_user_date;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $deactivate_reason;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $activate_reason;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $stripeCustomerId;
//so - spot owner
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $so_commission_rate_hourly = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $so_commission_rate_flexible = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $so_commission_rate_monthly = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $so_service_fee = 0;
/**
* @ORM\Column(type="integer")
*/
private $so_service_fee_type = 0;
// /**
// * @ORM\Column(type="decimal", precision=10, scale=2)
// */
// private $so_min_service_fee = 0;
//
//
// /**
// * @ORM\Column(type="decimal", precision=10, scale=2)
// */
// private $so_max_service_fee = 0;
/**
* @var \DateTime
* @ORM\Column(type="date", nullable=true)
*/
private $next_auto_payout_date;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $auto_payout_days = 0;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $address_line_one;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $address_line_two;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $postal_code;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $city;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $state;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $country;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $is_user_consumed_referral = false;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return User_Stripe_Details
*/
public function getUserStripeDetails()
{
return $this->user_stripe_details;
}
/**
* @param User_Stripe_Details $user_stripe_details
*/
public function setUserStripeDetails(User_Stripe_Details $user_stripe_details)
{
$this->user_stripe_details = $user_stripe_details;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getFirstName()
{
return $this->first_name;
}
/**
* @param mixed $first_name
*/
public function setFirstName($first_name)
{
$this->first_name = $first_name;
}
/**
* @return mixed
*/
public function getLastName()
{
return $this->last_name;
}
/**
* @param mixed $last_name
*/
public function setLastName($last_name)
{
$this->last_name = $last_name;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
/**
* @param mixed $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getMobile()
{
return $this->mobile;
}
/**
* @param mixed $mobile
*/
public function setMobile($mobile)
{
$this->mobile = $mobile;
}
/**
* @return mixed
*/
public function getPassword()
{
return $this->password;
}
/**
* @param mixed $password
*/
public function setPassword($password)
{
$this->password = $password;
}
/**
* @return mixed
*/
public function getLoginType()
{
return $this->login_type;
}
/**
* @param mixed $login_type
*/
public function setLoginType($login_type)
{
$this->login_type = $login_type;
}
/**
* @return mixed
*/
public function getisMobileVerified()
{
return $this->is_mobile_verified;
}
/**
* @param mixed $is_mobile_verified
*/
public function setIsMobileVerified($is_mobile_verified)
{
$this->is_mobile_verified = $is_mobile_verified;
}
/**
* @return mixed
*/
public function getActiveUserRole()
{
return $this->active_user_role;
}
/**
* @param mixed $active_user_role
*/
public function setActiveUserRole($active_user_role)
{
$this->active_user_role = $active_user_role;
}
/**
* @return mixed
*/
public function getDob()
{
return $this->dob;
}
/**
* @param mixed $dob
*/
public function setDob($dob)
{
$this->dob = $dob;
}
/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}
/**
* @param mixed $gender
*/
public function setGender($gender)
{
$this->gender = $gender;
}
/**
* @return mixed
*/
public function getisProfileComplete()
{
return $this->is_profile_complete;
}
/**
* @param mixed $is_profile_complete
*/
public function setIsProfileComplete($is_profile_complete)
{
$this->is_profile_complete = $is_profile_complete;
}
/**
* @return mixed
*/
public function getPasswordChangeDate()
{
return $this->password_change_date;
}
/**
* @param mixed $password_change_date
*/
public function setPasswordChangeDate($password_change_date)
{
$this->password_change_date = $password_change_date;
}
/**
* @return mixed
*/
public function getResetCode()
{
return $this->reset_code;
}
/**
* @param mixed $reset_code
*/
public function setResetCode($reset_code)
{
$this->reset_code = $reset_code;
}
/**
* @return mixed
*/
public function getResetCodeStartTimestamp()
{
return $this->reset_code_start_timestamp;
}
/**
* @param mixed $reset_code_start_timestamp
*/
public function setResetCodeStartTimestamp($reset_code_start_timestamp)
{
$this->reset_code_start_timestamp = $reset_code_start_timestamp;
}
/**
* @return mixed
*/
public function getResetPasswordToken()
{
return $this->reset_password_token;
}
/**
* @param mixed $reset_password_token
*/
public function setResetPasswordToken($reset_password_token)
{
$this->reset_password_token = $reset_password_token;
}
/**
* @return mixed
*/
public function getCountryCode()
{
return $this->country_code;
}
/**
* @param mixed $country_code
*/
public function setCountryCode($country_code)
{
$this->country_code = $country_code;
}
/**
* @return mixed
*/
public function getProfilePicUrl()
{
return $this->profile_pic_url;
}
/**
* @param mixed $profile_pic_url
*/
public function setProfilePicUrl($profile_pic_url)
{
$this->profile_pic_url = $profile_pic_url;
}
/**
* @return mixed
*/
public function getSocialProfileId()
{
return $this->social_profile_id;
}
/**
* @param mixed $social_profile_id
*/
public function setSocialProfileId($social_profile_id)
{
$this->social_profile_id = $social_profile_id;
}
/**
* @return mixed
*/
public function getSocialMediaProfilePicUrl()
{
return $this->social_media_profile_pic_url;
}
/**
* @param mixed $social_media_profile_pic_url
*/
public function setSocialMediaProfilePicUrl($social_media_profile_pic_url)
{
$this->social_media_profile_pic_url = $social_media_profile_pic_url;
}
/**
* @return mixed
*/
public function getPuLoginProcessSteps()
{
return $this->pu_login_process_steps;
}
/**
* @param mixed $pu_login_process_steps
*/
public function setPuLoginProcessSteps($pu_login_process_steps)
{
$this->pu_login_process_steps = $pu_login_process_steps;
}
/**
* @return WP_TimeZone
*/
public function getTimezone()
{
return $this->timezone;
}
/**
* @param mixed $timezone
*/
public function setTimezone($timezone)
{
$this->timezone = $timezone;
}
/**
* @return WP_Time_Format
*/
public function getTimeFormat()
{
return $this->time_format;
}
/**
* @param mixed $time_format
*/
public function setTimeFormat($time_format)
{
$this->time_format = $time_format;
}
/**
* @return WP_Date_Format
*/
public function getDateFormat()
{
return $this->date_format;
}
/**
* @param mixed $date_format
*/
public function setDateFormat($date_format)
{
$this->date_format = $date_format;
}
/**
* @return WP_Currency
*/
public function getCurrency()
{
return $this->currency;
}
/**
* @param mixed $currency
*/
public function setCurrency($currency)
{
$this->currency = $currency;
}
/**
* @return mixed
*/
public function getIsNewUser()
{
return $this->is_new_user;
}
/**
* @param mixed $is_new_user
*/
public function setIsNewUser($is_new_user)
{
$this->is_new_user = $is_new_user;
}
/**
* @return mixed
*/
public function getIsActive()
{
return $this->is_active;
}
/**
* @param mixed $is_active
*/
public function setIsActive($is_active)
{
$this->is_active = $is_active;
}
/**
* @return WP_Language
*/
public function getLanguage()
{
return $this->language;
}
/**
* @param mixed $language
*/
public function setLanguage($language)
{
$this->language = $language;
}
/**
* @return mixed
*/
public function getManageNotifications()
{
return $this->manage_notifications;
}
/**
* @param mixed $manage_notifications
*/
public function setManageNotifications($manage_notifications)
{
$this->manage_notifications = $manage_notifications;
}
/**
* @return mixed
*/
public function getInviteCode()
{
return $this->invite_code;
}
/**
* @param mixed $invite_code
*/
public function setInviteCode($invite_code)
{
$this->invite_code = $invite_code;
}
/**
* @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 getOrders()
{
return $this->orders;
}
/**
* @param mixed $orders
*/
public function setOrders($orders)
{
$this->orders = $orders;
}
/**
* @return mixed
*/
public function getFavSpot()
{
return $this->fav_spot;
}
/**
* @param mixed $fav_spot
*/
public function setFavSpot($fav_spot)
{
$this->fav_spot = $fav_spot;
}
/**
* @return mixed
*/
public function getAddSpot()
{
return $this->add_spot;
}
/**
* @param mixed $add_spot
*/
public function setAddSpot($add_spot)
{
$this->add_spot = $add_spot;
}
/**
* @return mixed
*/
public function getVehicles()
{
return $this->vehicles;
}
/**
* @param mixed $vehicles
*/
public function setVehicles($vehicles)
{
$this->vehicles = $vehicles;
}
/**
* @return mixed
*/
public function getTokens()
{
return $this->tokens;
}
/**
* @param mixed $tokens
*/
public function setTokens($tokens)
{
$this->tokens = $tokens;
}
/**
* @return \DateTime
*/
public function getLastActiveDate()
{
return $this->last_active_date;
}
/**
* @param mixed $last_active_date
*/
public function setLastActiveDate($last_active_date)
{
$this->last_active_date = $last_active_date;
}
/**
* @return mixed
*/
public function getUserRegisterDate()
{
return $this->user_register_date;
}
/**
* @param mixed $user_register_date
*/
public function setUserRegisterDate($user_register_date)
{
$this->user_register_date = $user_register_date;
}
/**
* @return mixed
*/
public function getIsSeeker()
{
return $this->is_seeker;
}
/**
* @param mixed $is_seeker
*/
public function setIsSeeker($is_seeker)
{
$this->is_seeker = $is_seeker;
}
/**
* @return mixed
*/
public function getIsProvider()
{
return $this->is_provider;
}
/**
* @param mixed $is_provider
*/
public function setIsProvider($is_provider)
{
$this->is_provider = $is_provider;
}
/**
* @return WP_Distance
*/
public function getDistance()
{
return $this->distance;
}
/**
* @param mixed $distance
*/
public function setDistance($distance)
{
$this->distance = $distance;
}
/**
* @return mixed
*/
public function getDeactivateStatus()
{
return $this->deactivate_status;
}
/**
* @param mixed $deactivate_status
*/
public function setDeactivateStatus($deactivate_status)
{
$this->deactivate_status = $deactivate_status;
}
/**
* @return \DateTime
*/
public function getDeactivateUserDate()
{
return $this->deactivate_user_date;
}
/**
* @param mixed $deactivate_user_date
*/
public function setDeactivateUserDate($deactivate_user_date)
{
$this->deactivate_user_date = $deactivate_user_date;
}
/**
* @return mixed
*/
public function getActivateUserDate()
{
return $this->activate_user_date;
}
/**
* @param mixed $activate_user_date
*/
public function setActivateUserDate($activate_user_date)
{
$this->activate_user_date = $activate_user_date;
}
/**
* @return mixed
*/
public function getDeactivateReason()
{
return $this->deactivate_reason;
}
/**
* @param mixed $deactivate_reason
*/
public function setDeactivateReason($deactivate_reason)
{
$this->deactivate_reason = $deactivate_reason;
}
/**
* @return mixed
*/
public function getActivateReason()
{
return $this->activate_reason;
}
/**
* @param mixed $activate_reason
*/
public function setActivateReason($activate_reason)
{
$this->activate_reason = $activate_reason;
}
/**
* @return mixed
*/
public function getStripeCustomerId()
{
return $this->stripeCustomerId;
}
/**
* @param mixed $stripeCustomerId
*/
public function setStripeCustomerId($stripeCustomerId)
{
$this->stripeCustomerId = $stripeCustomerId;
}
/**
* @return mixed
*/
public function getSoCommissionRateHourly()
{
return $this->so_commission_rate_hourly;
}
/**
* @param mixed $so_commission_rate_hourly
*/
public function setSoCommissionRateHourly($so_commission_rate_hourly)
{
$this->so_commission_rate_hourly = $so_commission_rate_hourly;
}
/**
* @return mixed
*/
public function getSoCommissionRateFlexible()
{
return $this->so_commission_rate_flexible;
}
/**
* @param mixed $so_commission_rate_flexible
*/
public function setSoCommissionRateFlexible($so_commission_rate_flexible)
{
$this->so_commission_rate_flexible = $so_commission_rate_flexible;
}
/**
* @return mixed
*/
public function getSoCommissionRateMonthly()
{
return $this->so_commission_rate_monthly;
}
/**
* @param mixed $so_commission_rate_monthly
*/
public function setSoCommissionRateMonthly($so_commission_rate_monthly)
{
$this->so_commission_rate_monthly = $so_commission_rate_monthly;
}
/**
* @return mixed
*/
public function getSoServiceFee()
{
return $this->so_service_fee;
}
/**
* @param mixed $so_service_fee
*/
public function setSoServiceFee($so_service_fee)
{
$this->so_service_fee = $so_service_fee;
}
/**
* @return mixed
*/
public function getSoServiceFeeType()
{
return $this->so_service_fee_type;
}
/**
* @param mixed $so_service_fee_type
*/
public function setSoServiceFeeType($so_service_fee_type)
{
$this->so_service_fee_type = $so_service_fee_type;
}
/**
* @return \DateTime
*/
public function getNextAutoPayoutDate()
{
return $this->next_auto_payout_date;
}
/**
* @param mixed $next_auto_payout_date
*/
public function setNextAutoPayoutDate($next_auto_payout_date)
{
$this->next_auto_payout_date = $next_auto_payout_date;
}
/**
* @return mixed
*/
public function getAutoPayoutDays()
{
return $this->auto_payout_days;
}
/**
* @param mixed $auto_payout_days
*/
public function setAutoPayoutDays($auto_payout_days)
{
$this->auto_payout_days = $auto_payout_days;
}
/**
* @return mixed
*/
public function getAddressLineOne()
{
return $this->address_line_one;
}
/**
* @param mixed $address_line_one
*/
public function setAddressLineOne($address_line_one)
{
$this->address_line_one = $address_line_one;
}
/**
* @return mixed
*/
public function getAddressLineTwo()
{
return $this->address_line_two;
}
/**
* @param mixed $address_line_two
*/
public function setAddressLineTwo($address_line_two)
{
$this->address_line_two = $address_line_two;
}
/**
* @return mixed
*/
public function getPostalCode()
{
return $this->postal_code;
}
/**
* @param mixed $postal_code
*/
public function setPostalCode($postal_code)
{
$this->postal_code = $postal_code;
}
/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}
/**
* @param mixed $city
*/
public function setCity($city)
{
$this->city = $city;
}
/**
* @return mixed
*/
public function getState()
{
return $this->state;
}
/**
* @param mixed $state
*/
public function setState($state)
{
$this->state = $state;
}
/**
* @return mixed
*/
public function getCountry()
{
return $this->country;
}
/**
* @param mixed $country
*/
public function setCountry($country)
{
$this->country = $country;
}
/**
* @return mixed
*/
public function getIsUserConsumedReferral()
{
return $this->is_user_consumed_referral;
}
/**
* @param mixed $is_user_consumed_referral
*/
public function setIsUserConsumedReferral($is_user_consumed_referral)
{
$this->is_user_consumed_referral = $is_user_consumed_referral;
}
/**
* @return ArrayCollection
*/
public function getActiveSpots() {
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('is_active', true))
->andWhere(Criteria::expr()->eq('is_saved', true));
return $this->add_spot->matching($criteria);
}
/**
* @return int
*/
public function getIncompleteSpotsCount() {
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('is_active', true))
->andWhere(Criteria::expr()->eq('is_saved', false))
->andWhere(Criteria::expr()->eq('spot_status', SpotStatus::Incomplete));
return $this->add_spot->matching($criteria)->count();
}
/**
* @return int
*/
public function getCompleteSpotsCount() {
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('is_active', true))
->andWhere(Criteria::expr()->eq('is_saved', true));
return $this->add_spot->matching($criteria)->count();
}
/**
* @return int
*/
public function getVerifiedSpotsCount() {
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('is_active', true))
->andWhere(Criteria::expr()->eq('is_verified', true))
->andWhere(Criteria::expr()->eq('is_saved', true));
return $this->add_spot->matching($criteria)->count();
}
/**
* @return int
*/
public function getCompletedNotVerifiedSpotsCount() {
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('is_active', true))
->andWhere(Criteria::expr()->eq('is_verified', false))
->andWhere(Criteria::expr()->eq('is_saved', true));
return $this->add_spot->matching($criteria)->count();
}
/**
* @return int
*/
public function getTotalSpotsCount() {
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('is_active', true));
return $this->add_spot->matching($criteria)->count();
}
//not_created - Not Created, incomplete - Incomplete, active - Active
public function getStripeAccountStatus() {
if ($this->getUserStripeDetails() instanceof User_Stripe_Details) {
if ($this->getUserStripeDetails()->getIsStripeIntegrationCompleted()) {
return 'active';
}
if ($this->getUserStripeDetails()->getIsStripeIntegrationStarted()) {
return 'incomplete';
}
return 'incomplete';
}
return 'not_created';
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'country_code' => $this->country_code,
'currency' => $this->currency->getId(),
'active_user_role' => $this->active_user_role,
'date_format' => $this->date_format->getId(),
'dob' => $this->dob != NULL ? $this->dob->format('Y-m-d') : "",
'email' => $this->email,
'first_name' => $this->first_name,
'gender' => $this->gender,
'is_mobile_verified' => $this->is_mobile_verified,
'is_profile_complete' => $this->is_profile_complete,
'language' => $this->language->getId(),
'last_name' => $this->last_name,
'login_type' => $this->login_type,
'mobile' => $this->mobile,
'profile_pic_url' => $this->profile_pic_url,
'pu_login_process_steps' => $this->pu_login_process_steps,
'time_format' => $this->time_format->getId(),
'timezone' => $this->timezone->getId(),
'invite_code' => $this->invite_code,
'last_active_date' => $this->last_active_date != NULL ? $this->last_active_date->format('Y-m-d H:i:s') : "",
'user_register_date' => $this->user_register_date != NULL ? $this->user_register_date->format('Y-m-d H:i:s') : "",
'password_change_date' => $this->password_change_date,
'is_seeker' => $this->is_seeker,
'is_provider' => $this->is_provider,
'is_active' => $this->is_active,
'distance_id' => $this->distance->getId(),
'stripeCustomerId' => $this->stripeCustomerId,
'so_commission_rate_hourly' => $this->so_commission_rate_hourly,
'so_commission_rate_flexible' => $this->so_commission_rate_flexible,
'so_commission_rate_monthly' => $this->so_commission_rate_monthly,
'so_service_fee' => $this->so_service_fee,
'so_service_fee_type' => $this->so_service_fee_type,
'auto_payout_days' => $this->auto_payout_days,
'next_auto_payout_date' => $this->next_auto_payout_date != NULL ? $this->next_auto_payout_date->format('Y-m-d') : "",
'address_line_one' => $this->address_line_one,
'address_line_two' => $this->address_line_two,
'postal_code' => $this->postal_code,
'stripe_account_status' => $this->getStripeAccountStatus(),
'city' => $this->city,
'state' => $this->state,
'country' => $this->country,
'is_user_consumed_referral' => $this->is_user_consumed_referral,
);
}
// public function __construct() {
// // we set up "created"+"modified"
// $this->setCreatedAt(round(microtime(true) * 1000));
// }
/**
* @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));
}
}
/**
* @return bool
*/
public function isIsUnsubscribedToEmail()
{
return $this->is_unsubscribed_to_email;
}
/**
* @param bool $is_unsubscribed_to_email
*/
public function setIsUnsubscribedToEmail($is_unsubscribed_to_email)
{
$this->is_unsubscribed_to_email = $is_unsubscribed_to_email;
}
public function __construct() {
$this->tokens = new ArrayCollection();
$this->vehicles = new ArrayCollection();
$this->add_spot = new ArrayCollection();
$this->fav_spot = 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));
}
}