<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
use App\Controller\GetCurrentUserController;
use App\Controller\ShareInviteController;
use App\Controller\UserCreateController;
use App\Controller\UserEditController;
use App\Enum\UserPrivacy;
use App\Enum\UserType;
use App\Filter\SimpleSearchFilter;
use App\Validator as AppAssert;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Greg0ire\Enum\Bridge\Symfony\Validator\Constraint\Enum as EnumAssert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\HasLifecycleCallbacks()
* @UniqueEntity(fields={"email"}, message="This email is already registered on the platform.", groups={"Registration", "Edition-Step1"})
* @Vich\Uploadable
* @AppAssert\DynamicValidationGroups(expression="this.getGender() and this.getGender().getOther()", value=true, validationGroups={"GenderOther"}, groups={"Edition-Step3"})
* @AppAssert\DynamicValidationGroups(expression="this.getRace() and this.getRace().getOther()", value=true, validationGroups={"RaceOther"}, groups={"Edition-Step3"})
* @AppAssert\DynamicValidationGroups(expression="this.getSexualOrientation() and this.getSexualOrientation().getOther()", value=true, validationGroups={"SexualOrientationOther"}, groups={"Edition-Step3"})
* @AppAssert\DynamicValidationGroups(expression="this.getReligion() and this.getReligion().getOther()", value=true, validationGroups={"ReligionOther"}, groups={"Edition-Step3"})
* @AppAssert\DynamicValidationGroups(expression="this.getDisabilityStatus() and this.getDisabilityStatus().getOther()", value=true, validationGroups={"DisabilityStatusOther"}, groups={"Edition-Step3"})
*/
#[ApiResource(
attributes: ['security' => "is_granted('PUBLIC_ACCESS')", 'validation_groups' => ['Default', 'Registration', 'Edition-Step1', 'Profile-Complete-Step0']],
#attributes: ['validation_groups' => ['Default', 'Registration', 'Edition-Step1', 'Profile-Complete-Step0']],
normalizationContext: ['groups' => ['user:item', 'user:list']],
denormalizationContext: ['groups' => ['user:write']],
collectionOperations: [
'get' => ['normalization_context' => ['groups' => ['user:list']]],
'post' => [
'security' => "is_granted('ROLE_ADMIN')",
'validation_groups' => ['Default', 'Registration'],
'method' => 'POST',
'path' => '/users',
'controller' => UserCreateController::class,
'normalization_context' => ['groups' => ['user:item']],
'defaults' => ['_api_receive' => false],
],
],
itemOperations: [
'get' => ['normalization_context' => ['groups' => ['user:item']]],
'put' => [
'security' => "is_granted('ROLE_ADMIN') or object.owner == user",
'validation_groups' => ['Default', 'Registration', 'Edition-Step1'],
'method' => 'PUT',
'path' => '/users/{id}',
'controller' => UserEditController::class
],
'current_user' => [
'method' => 'GET',
'path' => '/user/me',
'controller' => GetCurrentUserController::class,
'parameters' => [],
'read' => false,
],
'survey_share_invite_users' => [
'method' => 'POST',
'path' => '/user/{id}/share-invite',
'controller' => ShareInviteController::class,
],
'survey_share_invite_users' => [
'method' => 'POST',
'path' => '/user/{id}/import-hris',
'controller' => ImportHrisController::class,
],
'delete' => ['security' => "is_granted('ROLE_ADMIN')"],
],
)]
#[ApiFilter(SearchFilter::class, properties: ['firstName' => 'partial', 'lastName' => 'partial', 'email' => 'partial', 'fullNameWithEmail' => 'partial', 'role' => 'partial', 'company' => 'exact', 'enable' => 'exact', 'userType' => 'exact'])]
#[ApiFilter(PropertyFilter::class)]
#[ApiFilter(SimpleSearchFilter::class, properties: ['email', 'firstName', 'lastName'])]
#[ApiFilter(OrderFilter::class, properties: ['id', 'email', 'role', 'uniqueId', 'firstName', 'enableWelcome', 'enable', 'createdAt'], arguments: ['orderParameterName' => 'order'])]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
use TimestampableEntity;
public const USER_ROLE = 'ROLE_USER';
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @Groups({"user:item","user:list","pinpointCampaign:list"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"user:item", "user:list", "user:write","pinpointCampaign:list"})
*/
private $uniqueId;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="users")
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write","pinpointCampaign:list"})
*/
private $company;
/**
* @ORM\Column(type="string", length=128)
* @Assert\NotBlank(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
* @Assert\Regex("/^[a-z0-9() '`~]+$/i", message="the first name may only contain letters or the following caracters: ( , ) , ' , ` or ~", groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
* @Assert\Length(max=128)
* @Groups({"user:item", "user:list","user:write"})
*/
private $firstName;
/**
* @ORM\Column(type="string", length=128)
* @Assert\NotBlank(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
* @Assert\Regex("/^[a-z0-9() '`~]+$/i", message="the first name may only contain letters or the following caracters: ( , ) , ' , ` or ~", groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
* @Assert\Length(max=128)
* @Groups({"user:item", "user:list","user:write"})
*/
private $lastName;
/**
* @ORM\Column(type="string", length=128, unique=true)
* @Assert\NotBlank(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
* @Assert\Email(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
* @Assert\Length(max=128)
* @Groups({"user:item","user:list","pinpointCampaign:list", "user:write"})
*/
private $email;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Groups({"user:write"})
*/
private $password;
/**
* @ORM\Column(type="boolean")
* @Assert\Type("bool")
*/
private $isUserPassword;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $passwordRequestedAt;
/**
* @ORM\Column(name="confirmationToken", type="string", length=255, nullable=true)
*/
private $confirmationToken;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Assert\Length(max=64)
* @EnumAssert(class="App\Enum\OauthProviderType")
* @Groups({"user:item", "user:write"})
*/
private $oauthProvider;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $oauthUid;
/**
* @ORM\Column(type="string", length=1024, nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $oauthAccessToken;
/**
* @ORM\Column(type="json")
*/
private $roles = [];
/**
* @ORM\Column(type="datetime", nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $lastLoginAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $seeNotificationAt;
/**
* @ORM\Column(type="string", length=64, nullable=true)
* @Assert\Length(max=20)
* @Groups({"user:item", "user:write"})
*/
private $phone;
/**
* @var Address
*
* @ORM\Embedded(class="App\Entity\Address")
*/
private $address;
#[Groups('user:item')]
public ?string $imageUrl = null;
/**
* @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
*/
public $image;
/**
* @Vich\UploadableField(mapping="user", fileNameProperty="image.name",
* size="image.size", mimeType="image.mimeType",
* originalName="image.originalName",
* dimensions="image.dimensions"
* )
* @Assert\Image(
* maxSize="8M",
* mimeTypes={"image/jpeg", "image/png", "image/gif"},
* mimeTypesMessage="Allowed formats : .png, .jpeg, .jpg, gif ",
* groups={"Edition-Step1"}
* )
*/
#[Groups('user:write')]
public ?File $imageFile = null;
/**
* @ORM\Column(type="string", length=64)
* @Assert\Length(max=64)
* @Assert\NotBlank(groups={"Profile-Complete-Step1"})
* @EnumAssert(class="App\Enum\UserPrivacy", groups={"Edition-Step1"})
* @Groups({"user:item", "user:write"})
*/
private $privacy;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Badge")
* @Assert\NotNull(groups={"Registration","Profile-Complete-Step1"})
* @ORM\JoinColumn(nullable=false)
* @Groups({"user:item", "user:write"})
*/
private $badge;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\EducationLevel")
* @Assert\NotNull(groups={"Profile-Complete-Step2"})
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $educationLevel;
/**
* @var ArrayCollection|WorkExperience[]
*
* @ORM\OneToMany(targetEntity="App\Entity\WorkExperience", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
* @Assert\Count(
* min = 1,
* minMessage = "You must specify at least one work experience",
* groups={"Profile-Complete-Step2"}
* )
* @Assert\Valid(groups={"Edition-Step2", "Profile-Complete-Step2"})
* @Groups({"user:item", "user:write"})
*/
private iterable $workExperiences;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128)
* @Assert\NotBlank(groups={"Profile-Complete-Step3"})
* @EnumAssert(class="App\Enum\UserEmployeeStatus", groups={"Edition-Step3"})
* @Groups({"user:item", "user:write"})
*/
private $employeeStatus;
/**
* @ORM\Column(type="date", nullable=true)
* @Assert\NotNull(groups={"Profile-Complete-Step3"})
* @Assert\LessThan("today")
* @Groups({"user:item", "user:write"})
*/
private $birthDate;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\FamilyStatus")
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $familyStatus;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gender")
* @Assert\NotNull(groups={"Profile-Complete-Step3"})
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $gender;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\MaritalStatus")
* @Assert\NotNull(groups={"Profile-Complete-Step3"})
* @ORM\JoinColumn(nullable=true)
*/
private $maritalStatus;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128)
* @Assert\NotBlank(groups={"GenderOther"})
* @Groups({"user:item", "user:write"})
*/
private $genderOther;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Race")
* @Assert\NotNull(groups={"Profile-Complete-Step3"})
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $race;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128, groups={"RaceOther"})
* @Assert\NotBlank(groups={"RaceOther"})
* @Groups({"user:item", "user:write"})
*/
private $raceOther;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Ethnicity")
* @ORM\JoinColumn(nullable=true)
*/
private $ethnicity;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\NativeLanguageStatus")
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $nativeLanguageStatus;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128, groups={"Profile-Complete-Step3"})
* @Assert\NotBlank(groups={"Profile-Complete-Step3"})
* @Groups({"user:item", "user:write"})
*/
private $nativeLanguageStatusOther;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Religion")
* @Assert\NotNull(groups={"Profile-Complete-Step3"})
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $religion;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128, groups={"ReligionOther"})
* @Assert\NotBlank(groups={"ReligionOther"})
* @Groups({"user:item", "user:write"})
*/
private $religionOther;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DisabilityStatus")
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $disabilityStatus;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128, groups={"DiffenrentlyAbledOther"})
* @Assert\NotBlank(groups={"DiffenrentlyAbledOther"})
* @Groups({"user:item", "user:write"})
*/
private $disabilityStatusOther;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\SexualOrientation")
* @Assert\NotNull(groups={"Profile-Complete-Step3"})
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $sexualOrientation;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @Assert\Length(max=128, groups={"SexualOrientationOther"})
* @Assert\NotBlank(groups={"SexualOrientationOther"})
* @Groups({"user:item", "user:write"})
*/
private $sexualOrientationOther;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\TransgenderStatus")
* @Assert\NotBlank(groups={"Profile-Complete-Step3"})
* @ORM\JoinColumn(nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $transgenderStatus;
/**
* @ORM\Column(type="boolean")
* @Assert\Type("bool")
* @Groups({"user:item","user:list", "user:write"})
*/
private $enable;
/**
* @ORM\Column(type="boolean")
* @Assert\Type("bool")
* @Groups({"user:item", "user:list","user:write"})
*/
private ?bool $enableWelcome = false;
/**
* @ORM\Column(type="boolean")
* @Assert\Type("bool")
*/
private $viewWelcome;
/**
* @ORM\Column(type="boolean")
* @Assert\Type("bool")
* @Groups({"user:item", "user:write"})
*/
private $accessAdminPortal;
/**
* @ORM\Column(type="string", length=30, nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $role;
/**
* @ORM\Column(type="integer", nullable=true)
* @Groups({"user:item", "user:write"})
*/
private $nbReviews;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Review", cascade={"persist"}, mappedBy="user", orphanRemoval=true)
* @Assert\Valid()
*/
private $reviews;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserFollowCompany", mappedBy="user", orphanRemoval=true, cascade={"persist"})
*/
private $userFollowCompanies;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserLike", mappedBy="user", orphanRemoval=true, cascade={"persist"})
*/
private $userLikes;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Flagged", mappedBy="flagger", orphanRemoval=true, cascade={"persist"})
*/
private $flaggeds;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserCompany", mappedBy="user", orphanRemoval=true)
*/
private $userCompanies;
/**
* @var ArrayCollection
*
* @ORM\ManyToMany(targetEntity="App\Entity\Benefit")
* @Groups({"user:item", "user:write"})
*/
private $benefits;
/**
* @var ArrayCollection
*
* @ORM\ManyToMany(targetEntity="App\Entity\SocialGroupIssue")
* @Groups({"user:item", "user:write"})
*/
private $socialGroupIssues;
/**
* @var ArrayCollection|Industry[]
*
* @ORM\ManyToMany(targetEntity="App\Entity\Industry")
* @Groups({"user:item", "user:write"})
*/
private $industries;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserJob", mappedBy="user")
*/
private $userJobs;
/**
* @ORM\Column(type="string", length=20, nullable=true)
* @Assert\Length(max=20)
*/
private $yearsInIndustry;
/**
* @ORM\Column(type="string", length=20, nullable=true)
* @Assert\Length(max=20)
*/
private $tenure;
/**
* @var string
*
* @ORM\Column(type="string", length=50, nullable=false, columnDefinition="enum('generic', 'genuine')", options={"default": "genuine"})
* @Groups({"user:item", "user:write"})
*/
private $userType = UserType::GENUINE;
/**
* @var ArrayCollection|SurveyContribution[]
*
* @ORM\OneToMany(targetEntity="App\Entity\SurveyContribution", mappedBy="user", cascade={"persist"})
*/
private $surveyContributions;
/**
* @var Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\UserActivityLog", mappedBy="user", cascade={"persist"})
*/
private $userActivitylog;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\HouseholdIncome")
* @ORM\JoinColumn(nullable=true)
*/
private $householdIncome;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\CaregiverStatus")
* @ORM\JoinColumn(nullable=true)
*/
private $caregiverStatus;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\VeteranStatus")
* @ORM\JoinColumn(nullable=true)
*/
private $veteranStatus;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Politcs")
* @ORM\JoinColumn(nullable=true)
*/
private $politics;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\FirstGenerationStatus")
* @ORM\JoinColumn(nullable=true)
*/
private $firstGenerationStatus;
/**
* @ORM\OneToMany(targetEntity=PinpointCampaignUser::class, mappedBy="user", orphanRemoval=true)
*/
private $pinpointCampaignUsers;
/**
* @ORM\OneToMany(targetEntity=PinpointCampaignQuestion::class, mappedBy="user")
*/
private $pinpointCampaignQuestions;
/**
* @ORM\OneToMany(targetEntity=ScheduleRecipients::class, mappedBy="user", orphanRemoval=true)
*/
private $scheduleRecipients;
/**
* User constructor.
*/
public function __construct($email)
{
$this->email = $email;
$this->address = new Address();
$this->privacy = UserPrivacy::ANONYMOUS;
$this->confirmationToken = null;
$this->passwordRequestedAt = null;
$this->enable = false;
$this->isUserPassword = true;
$this->nbReviews = 0;
$this->genderOther = null;
$this->raceOther = null;
$this->sexualOrientationOther = null;
$this->religionOther = null;
$this->disabilityStatusOther = null;
$this->nativeLanguageStatusOther = null;
$this->lastLoginAt = null;
$this->workExperiences = new ArrayCollection();
$this->reviews = new ArrayCollection();
$this->userFollowCompanies = new ArrayCollection();
$this->benefits = new ArrayCollection();
$this->socialGroupIssues = new ArrayCollection();
$this->industries = new ArrayCollection();
$this->userLikes = new ArrayCollection();
$this->seeNotificationAt = new DateTime();
$this->flaggeds = new ArrayCollection();
$this->userCompanies = new ArrayCollection();
$this->surveyContributions = new ArrayCollection();
$this->userActivitylog = new ArrayCollection();
$this->enableWelcome = false;
$this->viewWelcome = null;
$this->accessAdminPortal = false;
$this->role = null;
$this->userJobs = new ArrayCollection();
$this->pinpointCampaignUsers = new ArrayCollection();
$this->pinpointCampaignQuestions = new ArrayCollection();
$this->scheduleRecipients = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
/**
* Returning a salt is only needed, if you are not using a modern
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
*
* @see UserInterface
*/
public function getSalt(): ?string
{
return null;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}
public function getUsername(): ?string
{
return $this->email;
}
/**
* The public representation of the user (e.g. a email address, etc.).
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->email;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
public function setRoles(array $roles): self
{
$this->roles = $roles;
return $this;
}
public function eraseCredentials()
{
}
public function getConfirmationToken(): ?string
{
return $this->confirmationToken;
}
public function setConfirmationToken(?string $confirmationToken): self
{
$this->confirmationToken = $confirmationToken;
return $this;
}
public function getUniqueId(): ?string
{
return $this->uniqueId;
}
public function setUniqueId(?string $uniqueId): self
{
$this->uniqueId = $uniqueId;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getIsUserPassword(): ?bool
{
return $this->isUserPassword;
}
public function setIsUserPassword(bool $isUserPassword): self
{
$this->isUserPassword = $isUserPassword;
return $this;
}
public function getPasswordRequestedAt(): ?DateTime
{
return $this->passwordRequestedAt;
}
public function setPasswordRequestedAt(?DateTime $passwordRequestedAt): self
{
$this->passwordRequestedAt = $passwordRequestedAt;
return $this;
}
/**
* @return Collection|UserCompany[]
*/
public function getUserCompanies(): Collection
{
return $this->userCompanies;
}
public function addUserCompany(UserCompany $userCompany): self
{
if (!$this->userCompanies->contains($userCompany)) {
$this->userCompanies[] = $userCompany;
$userCompany->setUser($this);
}
return $this;
}
public function removeUserCompany(UserCompany $userCompany): self
{
if ($this->userCompanies->contains($userCompany)) {
$this->userCompanies->removeElement($userCompany);
// set the owning side to null (unless already changed)
if ($userCompany->getUser() === $this) {
$userCompany->setUser(null);
}
}
return $this;
}
public function getOauthProvider(): ?string
{
return $this->oauthProvider;
}
public function setOauthProvider(?string $oauthProvider): self
{
$this->oauthProvider = $oauthProvider;
return $this;
}
public function getOauthUid(): ?string
{
return $this->oauthUid;
}
public function setOauthUid(?string $oauthUid): self
{
$this->oauthUid = $oauthUid;
return $this;
}
public function getOauthAccessToken(): ?string
{
return $this->oauthAccessToken;
}
public function setOauthAccessToken(?string $oauthAccessToken): self
{
$this->oauthAccessToken = $oauthAccessToken;
return $this;
}
public function getLastLoginAt(): ?DateTime
{
return $this->lastLoginAt;
}
public function setLastLoginAt(?DateTime $lastLoginAt): self
{
$this->lastLoginAt = $lastLoginAt;
return $this;
}
public function getSeeNotificationAt(): ?DateTime
{
return $this->seeNotificationAt;
}
public function setSeeNotificationAt(?DateTime $seeNotificationAt): self
{
$this->seeNotificationAt = $seeNotificationAt;
return $this;
}
public function getBadge(): ?Badge
{
return $this->badge;
}
public function setBadge(Badge $badge): self
{
$this->badge = $badge;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(?Address $address): self
{
$this->address = $address;
return $this;
}
public function getEducationLevel(): ?EducationLevel
{
return $this->educationLevel;
}
public function setEducationLevel(?EducationLevel $educationLevel): self
{
$this->educationLevel = $educationLevel;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function setImageFile(File $image = null)
{
$this->imageFile = $image;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($image) {
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}
public function getImageFile()
{
return $this->imageFile;
}
public function setImage($image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function getPrivacy(): ?string
{
return $this->privacy;
}
public function setPrivacy(?string $privacy): self
{
$this->privacy = $privacy;
return $this;
}
public function getGender(): ?Gender
{
return $this->gender;
}
public function setGender(?Gender $gender): self
{
$this->gender = $gender;
return $this;
}
public function getRace(): ?Race
{
return $this->race;
}
public function setRace(?Race $race): self
{
$this->race = $race;
return $this;
}
public function getEthnticity(): ?Ethnicity
{
return $this->ethnicity;
}
public function setEthnticity(?Ethnicity $ethnicity): self
{
$this->ethnicity = $ethnicity;
return $this;
}
public function getSexualOrientation(): ?SexualOrientation
{
return $this->sexualOrientation;
}
public function setSexualOrientation(?SexualOrientation $sexualOrientation): self
{
$this->sexualOrientation = $sexualOrientation;
return $this;
}
public function getFirstGenerationStatus(): ?FirstGenerationStatus
{
return $this->firstGenerationStatus;
}
public function setFirstGenerationStatus(?FirstGenerationStatus $firstGenerationStatus): self
{
$this->firstGenerationStatus = $firstGenerationStatus;
return $this;
}
public function getVeteranStatus(): ?VeteranStatus
{
return $this->veteranStatus;
}
public function setVeteranStatus(?VeteranStatus $veteranStatus): self
{
$this->veteranStatus = $veteranStatus;
return $this;
}
public function getMaritalStatus(): ?MaritalStatus
{
return $this->maritalStatus;
}
public function setMaritalStatus(?MaritalStatus $maritalStatus): self
{
$this->maritalStatus = $maritalStatus;
return $this;
}
public function getPolitcs(): ?Politcs
{
return $this->politics;
}
public function setPolitcs(?Politcs $politics): self
{
$this->politics = $politics;
return $this;
}
public function getHouseholdIncome(): ?HouseholdIncome
{
return $this->householdIncome;
}
public function setHouseholdIncome(?HouseholdIncome $householdIncome): self
{
$this->householdIncome = $householdIncome;
return $this;
}
public function getCaregiverStatus(): ?CaregiverStatus
{
return $this->caregiverStatus;
}
public function setCaregiverStatus(?CaregiverStatus $caregiverStatus): self
{
$this->caregiverStatus = $caregiverStatus;
return $this;
}
public function getBirthDate(): ?DateTime
{
return $this->birthDate;
}
public function setBirthDate(?DateTime $birthDate): self
{
$this->birthDate = $birthDate;
return $this;
}
public function getFamilyStatus(): ?FamilyStatus
{
return $this->familyStatus;
}
public function setFamilyStatus(?FamilyStatus $familyStatus): self
{
$this->familyStatus = $familyStatus;
return $this;
}
public function getReligion(): ?Religion
{
return $this->religion;
}
public function setReligion(?Religion $religion): self
{
$this->religion = $religion;
return $this;
}
public function getNativeLanguageStatus(): ?NativeLanguageStatus
{
return $this->nativeLanguageStatus;
}
public function setNativeLanguageStatus(?NativeLanguageStatus $nativeLanguageStatus): self
{
$this->nativeLanguageStatus = $nativeLanguageStatus;
return $this;
}
public function getNativeLanguageStatusOther(): ?string
{
return $this->nativeLanguageStatusOther;
}
public function setNativeLanguageStatusOther(?string $nativeLanguageStatusOther): self
{
$this->nativeLanguageStatusOther = $nativeLanguageStatusOther;
return $this;
}
public function getEmployeeStatus(): ?string
{
return $this->employeeStatus;
}
public function setEmployeeStatus(?string $employeeStatus): self
{
$this->employeeStatus = $employeeStatus;
return $this;
}
public function getDisabilityStatus(): ?DisabilityStatus
{
return $this->disabilityStatus;
}
public function setDisabilityStatus(?DisabilityStatus $disabilityStatus): self
{
$this->disabilityStatus = $disabilityStatus;
return $this;
}
public function getDisabilityStatusOther(): ?string
{
return $this->disabilityStatusOther;
}
public function setDisabilityStatusOther(?string $disabilityStatusOther): self
{
$this->disabilityStatusOther = $disabilityStatusOther;
return $this;
}
public function getEnable(): ?bool
{
return $this->enable;
}
public function setEnable(bool $enable): self
{
$this->enable = $enable;
return $this;
}
public function getEnableWelcome(): ?bool
{
return $this->enableWelcome;
}
public function setEnableWelcome(bool $enableWelcome): self
{
$this->enableWelcome = $enableWelcome;
return $this;
}
public function getViewWelcome(): ?bool
{
return $this->viewWelcome;
}
public function setViewWelcome(bool $viewWelcome): self
{
$this->viewWelcome = $viewWelcome;
return $this;
}
public function getAccessAdminPortal(): ?bool
{
return $this->accessAdminPortal;
}
public function setAccessAdminPortal(bool $accessAdminPortal): self
{
$this->accessAdminPortal = $accessAdminPortal;
return $this;
}
public function getRole(): ?string
{
return $this->role;
}
public function setRole(?string $role): self
{
$this->role = $role;
return $this;
}
public function getUserType(): ?string
{
return $this->userType;
}
public function setUserType(string $userType): self
{
$this->userType = $userType;
return $this;
}
/**
* @return Collection<int, WorkExperience>
*/
public function getWorkExperiences(): Collection
{
return $this->workExperiences;
}
public function addWorkExperience(WorkExperience $workExperience): self
{
if (!$this->workExperiences->contains($workExperience)) {
$this->workExperiences[] = $workExperience;
$workExperience->setUser($this);
}
return $this;
}
public function removeWorkExperience(WorkExperience $workExperience): self
{
if ($this->workExperiences->contains($workExperience)) {
$this->workExperiences->removeElement($workExperience);
// set the owning side to null (unless already changed)
if ($workExperience->getUser() === $this) {
$workExperience->setUser(null);
}
}
return $this;
}
/**
* @return Collection|Review[]
*/
public function getReviews(): Collection
{
return $this->reviews;
}
public function addReview(Review $review): self
{
if (!$this->reviews->contains($review)) {
$this->reviews[] = $review;
$review->setUser($this);
}
return $this;
}
public function removeReview(Review $review): self
{
if ($this->reviews->contains($review)) {
$this->reviews->removeElement($review);
// set the owning side to null (unless already changed)
if ($review->getUser() === $this) {
$review->setUser(null);
}
}
return $this;
}
public function getNbReviews(): ?int
{
return $this->nbReviews;
}
public function setNbReviews(?int $nbReviews): self
{
$this->nbReviews = $nbReviews;
return $this;
}
/**
* @return Collection|UserFollowCompany[]
*/
public function getUserFollowCompanies(): Collection
{
return $this->userFollowCompanies;
}
public function addUserFollowCompany(UserFollowCompany $userFollowCompany): self
{
if (!$this->userFollowCompanies->contains($userFollowCompany)) {
$this->userFollowCompanies[] = $userFollowCompany;
$userFollowCompany->setUser($this);
}
return $this;
}
public function removeUserFollowCompany(UserFollowCompany $userFollowCompany): self
{
if ($this->userFollowCompanies->contains($userFollowCompany)) {
$this->userFollowCompanies->removeElement($userFollowCompany);
// set the owning side to null (unless already changed)
if ($userFollowCompany->getUser() === $this) {
$userFollowCompany->setUser(null);
}
}
return $this;
}
public function getGenderOther(): ?string
{
return $this->genderOther;
}
public function setGenderOther(?string $genderOther): self
{
$this->genderOther = $genderOther;
return $this;
}
/**
* @return Collection|Benefit[]
*/
public function getBenefits(): Collection
{
return $this->benefits;
}
public function getTransgenderStatus(): ?TransgenderStatus
{
return $this->transgenderStatus;
}
public function setTransgenderStatus(?TransgenderStatus $transgenderStatus): self
{
$this->transgenderStatus = $transgenderStatus;
return $this;
}
public function getRaceOther(): ?string
{
return $this->raceOther;
}
public function setRaceOther(?string $raceOther): self
{
$this->raceOther = $raceOther;
return $this;
}
public function getSexualOrientationOther(): ?string
{
return $this->sexualOrientationOther;
}
public function setSexualOrientationOther(?string $sexualOrientationOther): self
{
$this->sexualOrientationOther = $sexualOrientationOther;
return $this;
}
public function getReligionOther(): ?string
{
return $this->religionOther;
}
public function setReligionOther(?string $religionOther): self
{
$this->religionOther = $religionOther;
return $this;
}
public function addBenefit(Benefit $benefit): self
{
if (!$this->benefits->contains($benefit)) {
$this->benefits[] = $benefit;
}
return $this;
}
public function removeBenefit(Benefit $benefit): self
{
if ($this->benefits->contains($benefit)) {
$this->benefits->removeElement($benefit);
}
return $this;
}
/**
* @return Collection|SocialGroupIssue[]
*/
public function getSocialGroupIssues(): Collection
{
return $this->socialGroupIssues;
}
public function addSocialGroupIssue(SocialGroupIssue $socialGroupIssue): self
{
if (!$this->socialGroupIssues->contains($socialGroupIssue)) {
$this->socialGroupIssues[] = $socialGroupIssue;
}
return $this;
}
public function removeSocialGroupIssue(SocialGroupIssue $socialGroupIssue): self
{
if ($this->socialGroupIssues->contains($socialGroupIssue)) {
$this->socialGroupIssues->removeElement($socialGroupIssue);
}
return $this;
}
/**
* @return Collection|Industry[]
*/
public function getIndustries(): Collection
{
return $this->industries;
}
public function addIndustry(Industry $industry): self
{
if (!$this->industries->contains($industry)) {
$this->industries[] = $industry;
}
return $this;
}
public function removeIndustry(Industry $industry): self
{
if ($this->industries->contains($industry)) {
$this->industries->removeElement($industry);
}
return $this;
}
public function __toString(): string
{
return $this->lastName . ' ' . $this->firstName . ' (' . $this->getUsername() . ')';
}
/**
* @return Collection<int, PinpointCampaignUser>
*/
public function getPinpointCampaignUsers(): Collection
{
return $this->pinpointCampaignUsers;
}
public function addPinpointCampaignUser(PinpointCampaignUser $pinpointCampaignUser): self
{
if (!$this->pinpointCampaignUsers->contains($pinpointCampaignUser)) {
$this->pinpointCampaignUsers[] = $pinpointCampaignUser;
$pinpointCampaignUser->setUser($this);
}
return $this;
}
public function removePinpointCampaignUser(PinpointCampaignUser $pinpointCampaignUser): self
{
if ($this->pinpointCampaignUsers->removeElement($pinpointCampaignUser)) {
// set the owning side to null (unless already changed)
if ($pinpointCampaignUser->getUser() === $this) {
$pinpointCampaignUser->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, PinpointCampaignQuestion>
*/
public function getPinpointCampaignQuestions(): Collection
{
return $this->pinpointCampaignQuestions;
}
#[Groups('user:item')]
public function getTotalPinpointCampaignQuestions(): int
{
return $this->pinpointCampaignQuestions->count();
}
public function addPinpointCampaignQuestion(PinpointCampaignQuestion $pinpointCampaignQuestion): self
{
if (!$this->pinpointCampaignQuestions->contains($pinpointCampaignQuestion)) {
$this->pinpointCampaignQuestions[] = $pinpointCampaignQuestion;
$pinpointCampaignQuestion->setUser($this);
}
return $this;
}
public function removePinpointCampaignQuestion(PinpointCampaignQuestion $pinpointCampaignQuestion): self
{
if ($this->pinpointCampaignQuestions->removeElement($pinpointCampaignQuestion)) {
// set the owning side to null (unless already changed)
if ($pinpointCampaignQuestion->getUser() === $this) {
$pinpointCampaignQuestion->setUser(null);
}
}
return $this;
}
/**
* @return Collection|<int, SurveyContribution>
*/
public function getSurveyContributions(): Collection
{
return $this->surveyContributions;
}
#[Groups('user:item')]
public function getTotalContributionQuestion(?PinpointCampaign $pinpointCampaign): int
{
if ($pinpointCampaign->getId()) {
return $this->surveyContributions->filter(function (SurveyContribution $item) use ($pinpointCampaign) {
return $item->getPinpointCampaign() == $pinpointCampaign;
})->count();
} else {
return $this->surveyContributions->count();
}
}
#[Groups('user:item')]
public function getContributionCreatedAt(): ?DateTime
{
return $this->surveyContributions->count() ? $this->surveyContributions[0]->getCreatedAt() : null;
}
#[Groups('user:item')]
public function getContributionStatus(): ?string
{
$isDraft = false;
foreach ($this->surveyContributions as $surveyContribution) {
foreach ($surveyContribution->getContributionSteps() as $surveyStep) {
foreach ($surveyStep->getContributionQuestions() as $question) {
$isDraft = $question->getIsDraft();
}
}
}
if ($isDraft) {
return 'Submitted As Draft on';
}
return $this->surveyContributions->count() ? ucwords($this->surveyContributions[0]->getStatus()) . ' on' : '';
}
public function addSurveyContribution(SurveyContribution $surveyContribution): self
{
if (!$this->surveyContributions->contains($surveyContribution)) {
$this->surveyContributions[] = $surveyContribution;
$surveyContribution->setUser($this);
}
return $this;
}
public function removeSurveyContribution(SurveyContribution $surveyContribution): self
{
if ($this->surveyContributions->contains($surveyContribution)) {
$this->surveyContributions->removeElement($surveyContribution);
// set the owning side to null (unless already changed)
if ($surveyContribution->getUser() === $this) {
$surveyContribution->setUser(null);
}
}
return $this;
}
/**
* @return Collection|UserActivityLog[]
*/
public function getUserActivityLog(): Collection
{
return $this->userActivitylog;
}
public function addUserActivityLog(UserActivityLog $userActivitylog): self
{
if (!$this->userActivitylog->contains($userActivitylog)) {
$this->userActivitylog[] = $userActivitylog;
$userActivitylog->setUser($this);
}
return $this;
}
public function removeUserActivityLog(UserActivityLog $userActivitylog): self
{
if ($this->userActivitylog->contains($userActivitylog)) {
$this->userActivitylog->removeElement($userActivitylog);
// set the owning side to null (unless already changed)
if ($userActivitylog->getUser() === $this) {
$userActivitylog->setUser(null);
}
}
return $this;
}
#[Groups(['user:item', 'user:list', "campaignSchedule:read"])]
public function getFullNameWithEmail(): string
{
return $this->lastName . ' ' . $this->firstName . ' (' . $this->getUsername() . ')';
}
#[Groups(["user:item", "user:list"])]
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt ?? null;
}
#[Groups('user:item')]
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
/**
* @return Collection<int, ScheduleRecipients>
*/
public function getScheduleRecipients(): Collection
{
return $this->scheduleRecipients;
}
public function addScheduleRecipient(ScheduleRecipients $scheduleRecipient): self
{
if (!$this->scheduleRecipients->contains($scheduleRecipient)) {
$this->scheduleRecipients[] = $scheduleRecipient;
$scheduleRecipient->setUser($this);
}
return $this;
}
public function removeScheduleRecipient(ScheduleRecipients $scheduleRecipient): self
{
if ($this->scheduleRecipients->removeElement($scheduleRecipient)) {
// set the owning side to null (unless already changed)
if ($scheduleRecipient->getUser() === $this) {
$scheduleRecipient->setUser(null);
}
}
return $this;
}
}