src/Entity/User.php line 93

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  7. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  8. use App\Controller\GetCurrentUserController;
  9. use App\Controller\ShareInviteController;
  10. use App\Controller\UserCreateController;
  11. use App\Controller\UserEditController;
  12. use App\Enum\UserPrivacy;
  13. use App\Enum\UserType;
  14. use App\Filter\SimpleSearchFilter;
  15. use App\Validator as AppAssert;
  16. use DateTime;
  17. use Doctrine\Common\Collections\ArrayCollection;
  18. use Doctrine\Common\Collections\Collection;
  19. use Doctrine\ORM\Mapping as ORM;
  20. use Gedmo\Timestampable\Traits\TimestampableEntity;
  21. use Greg0ire\Enum\Bridge\Symfony\Validator\Constraint\Enum as EnumAssert;
  22. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  23. use Symfony\Component\HttpFoundation\File\File;
  24. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  25. use Symfony\Component\Security\Core\User\UserInterface;
  26. use Symfony\Component\Serializer\Annotation\Groups;
  27. use Symfony\Component\Validator\Constraints as Assert;
  28. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  29. /**
  30.  * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
  31.  * @ORM\HasLifecycleCallbacks()
  32.  * @UniqueEntity(fields={"email"}, message="This email is already registered on the platform.", groups={"Registration", "Edition-Step1"})
  33.  * @Vich\Uploadable
  34.  * @AppAssert\DynamicValidationGroups(expression="this.getGender() and this.getGender().getOther()", value=true, validationGroups={"GenderOther"}, groups={"Edition-Step3"})
  35.  * @AppAssert\DynamicValidationGroups(expression="this.getRace() and this.getRace().getOther()", value=true, validationGroups={"RaceOther"}, groups={"Edition-Step3"})
  36.  * @AppAssert\DynamicValidationGroups(expression="this.getSexualOrientation() and this.getSexualOrientation().getOther()", value=true, validationGroups={"SexualOrientationOther"}, groups={"Edition-Step3"})
  37.  * @AppAssert\DynamicValidationGroups(expression="this.getReligion() and this.getReligion().getOther()", value=true, validationGroups={"ReligionOther"}, groups={"Edition-Step3"})
  38.  * @AppAssert\DynamicValidationGroups(expression="this.getDisabilityStatus() and this.getDisabilityStatus().getOther()", value=true, validationGroups={"DisabilityStatusOther"}, groups={"Edition-Step3"})
  39.  */
  40. #[ApiResource(
  41.     attributes: ['security' => "is_granted('PUBLIC_ACCESS')"'validation_groups' => ['Default''Registration''Edition-Step1''Profile-Complete-Step0']],
  42.     #attributes: ['validation_groups' => ['Default', 'Registration', 'Edition-Step1', 'Profile-Complete-Step0']],
  43.     normalizationContext: ['groups' => ['user:item''user:list']],
  44.     denormalizationContext: ['groups' => ['user:write']],
  45.     collectionOperations: [
  46.         'get' => ['normalization_context' => ['groups' => ['user:list']]],
  47.         'post' => [
  48.             'security' => "is_granted('ROLE_ADMIN')",
  49.             'validation_groups' => ['Default''Registration'],
  50.             'method' => 'POST',
  51.             'path' => '/users',
  52.             'controller' => UserCreateController::class,
  53.             'normalization_context' => ['groups' => ['user:item']],
  54.             'defaults' => ['_api_receive' => false],
  55.         ],
  56.     ],
  57.     itemOperations: [
  58.         'get' => ['normalization_context' => ['groups' => ['user:item']]],
  59.         'put' => [
  60.             'security' => "is_granted('ROLE_ADMIN') or object.owner == user",
  61.             'validation_groups' => ['Default''Registration''Edition-Step1'],
  62.             'method' => 'PUT',
  63.             'path' => '/users/{id}',
  64.             'controller' => UserEditController::class
  65.         ],
  66.         'current_user' => [
  67.             'method' => 'GET',
  68.             'path' => '/user/me',
  69.             'controller' => GetCurrentUserController::class,
  70.             'parameters' => [],
  71.             'read' => false,
  72.         ],
  73.         'survey_share_invite_users' => [
  74.             'method' => 'POST',
  75.             'path' => '/user/{id}/share-invite',
  76.             'controller' => ShareInviteController::class,
  77.         ],
  78.         'survey_share_invite_users' => [
  79.             'method' => 'POST',
  80.             'path' => '/user/{id}/import-hris',
  81.             'controller' => ImportHrisController::class,
  82.         ],
  83.         'delete' => ['security' => "is_granted('ROLE_ADMIN')"],
  84.     ],
  85. )]
  86. #[ApiFilter(SearchFilter::class, properties: ['firstName' => 'partial''lastName' => 'partial''email' => 'partial''fullNameWithEmail' => 'partial''role' => 'partial''company' => 'exact''enable' => 'exact''userType' => 'exact'])]
  87. #[ApiFilter(PropertyFilter::class)]
  88. #[ApiFilter(SimpleSearchFilter::class, properties: ['email''firstName''lastName'])]
  89. #[ApiFilter(OrderFilter::class, properties: ['id''email''role''uniqueId''firstName''enableWelcome''enable''createdAt'], arguments: ['orderParameterName' => 'order'])]
  90. class User implements UserInterfacePasswordAuthenticatedUserInterface
  91. {
  92.     use TimestampableEntity;
  93.     public const USER_ROLE 'ROLE_USER';
  94.     /**
  95.      * @ORM\Id()
  96.      * @ORM\GeneratedValue()
  97.      * @ORM\Column(type="integer")
  98.      * @Groups({"user:item","user:list","pinpointCampaign:list"})
  99.      */
  100.     private $id;
  101.     /**
  102.      * @ORM\Column(type="string", length=255, nullable=true)
  103.      * @Groups({"user:item", "user:list", "user:write","pinpointCampaign:list"})
  104.      */
  105.     private $uniqueId;
  106.     /**
  107.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="users")
  108.      * @ORM\JoinColumn(nullable=true)
  109.      * @Groups({"user:item", "user:write","pinpointCampaign:list"})
  110.      */
  111.     private $company;
  112.     /**
  113.      * @ORM\Column(type="string", length=128)
  114.      * @Assert\NotBlank(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
  115.      * @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"})
  116.      * @Assert\Length(max=128)
  117.      * @Groups({"user:item", "user:list","user:write"})
  118.      */
  119.     private $firstName;
  120.     /**
  121.      * @ORM\Column(type="string", length=128)
  122.      * @Assert\NotBlank(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
  123.      * @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"})
  124.      * @Assert\Length(max=128)
  125.      * @Groups({"user:item", "user:list","user:write"})
  126.      */
  127.     private $lastName;
  128.     /**
  129.      * @ORM\Column(type="string", length=128, unique=true)
  130.      * @Assert\NotBlank(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
  131.      * @Assert\Email(groups={"Registration", "Edition-Step1", "Profile-Complete-Step0"})
  132.      * @Assert\Length(max=128)
  133.      * @Groups({"user:item","user:list","pinpointCampaign:list", "user:write"})
  134.      */
  135.     private $email;
  136.     /**
  137.      * @ORM\Column(type="string", length=64, nullable=true)
  138.      * @Groups({"user:write"})
  139.      */
  140.     private $password;
  141.     /**
  142.      * @ORM\Column(type="boolean")
  143.      * @Assert\Type("bool")
  144.      */
  145.     private $isUserPassword;
  146.     /**
  147.      * @ORM\Column(type="datetime", nullable=true)
  148.      */
  149.     private $passwordRequestedAt;
  150.     /**
  151.      * @ORM\Column(name="confirmationToken", type="string", length=255, nullable=true)
  152.      */
  153.     private $confirmationToken;
  154.     /**
  155.      * @ORM\Column(type="string", length=64, nullable=true)
  156.      * @Assert\Length(max=64)
  157.      * @EnumAssert(class="App\Enum\OauthProviderType")
  158.      * @Groups({"user:item", "user:write"})
  159.      */
  160.     private $oauthProvider;
  161.     /**
  162.      * @ORM\Column(type="string", length=128, nullable=true)
  163.      * @Groups({"user:item", "user:write"})
  164.      */
  165.     private $oauthUid;
  166.     /**
  167.      * @ORM\Column(type="string", length=1024, nullable=true)
  168.      * @Groups({"user:item", "user:write"})
  169.      */
  170.     private $oauthAccessToken;
  171.     /**
  172.      * @ORM\Column(type="json")
  173.      */
  174.     private $roles = [];
  175.     /**
  176.      * @ORM\Column(type="datetime", nullable=true)
  177.      * @Groups({"user:item", "user:write"})
  178.      */
  179.     private $lastLoginAt;
  180.     /**
  181.      * @ORM\Column(type="datetime", nullable=true)
  182.      */
  183.     private $seeNotificationAt;
  184.     /**
  185.      * @ORM\Column(type="string", length=64, nullable=true)
  186.      * @Assert\Length(max=20)
  187.      * @Groups({"user:item", "user:write"})
  188.      */
  189.     private $phone;
  190.     /**
  191.      * @var Address
  192.      *
  193.      * @ORM\Embedded(class="App\Entity\Address")
  194.      */
  195.     private $address;
  196.     #[Groups('user:item')]
  197.     public ?string $imageUrl null;
  198.     /**
  199.      * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
  200.      */
  201.     public $image;
  202.     /**
  203.      * @Vich\UploadableField(mapping="user", fileNameProperty="image.name",
  204.      *     size="image.size", mimeType="image.mimeType",
  205.      *     originalName="image.originalName",
  206.      *     dimensions="image.dimensions"
  207.      * )
  208.      * @Assert\Image(
  209.      *     maxSize="8M",
  210.      *     mimeTypes={"image/jpeg", "image/png", "image/gif"},
  211.      *     mimeTypesMessage="Allowed formats : .png, .jpeg, .jpg, gif ",
  212.      *     groups={"Edition-Step1"}
  213.      * )
  214.      */
  215.     #[Groups('user:write')]
  216.     public ?File $imageFile null;
  217.     /**
  218.      * @ORM\Column(type="string", length=64)
  219.      * @Assert\Length(max=64)
  220.      * @Assert\NotBlank(groups={"Profile-Complete-Step1"})
  221.      * @EnumAssert(class="App\Enum\UserPrivacy", groups={"Edition-Step1"})
  222.      * @Groups({"user:item", "user:write"})
  223.      */
  224.     private $privacy;
  225.     /**
  226.      * @ORM\ManyToOne(targetEntity="App\Entity\Badge")
  227.      * @Assert\NotNull(groups={"Registration","Profile-Complete-Step1"})
  228.      * @ORM\JoinColumn(nullable=false)
  229.      * @Groups({"user:item", "user:write"})
  230.      */
  231.     private $badge;
  232.     /**
  233.      * @ORM\ManyToOne(targetEntity="App\Entity\EducationLevel")
  234.      * @Assert\NotNull(groups={"Profile-Complete-Step2"})
  235.      * @ORM\JoinColumn(nullable=true)
  236.      * @Groups({"user:item", "user:write"})
  237.      */
  238.     private $educationLevel;
  239.     /**
  240.      * @var ArrayCollection|WorkExperience[]
  241.      *
  242.      * @ORM\OneToMany(targetEntity="App\Entity\WorkExperience", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
  243.      * @Assert\Count(
  244.      *      min = 1,
  245.      *      minMessage = "You must specify at least one work experience",
  246.      *      groups={"Profile-Complete-Step2"}
  247.      * )
  248.      * @Assert\Valid(groups={"Edition-Step2", "Profile-Complete-Step2"})
  249.      * @Groups({"user:item", "user:write"})
  250.      */
  251.     private iterable $workExperiences;
  252.     /**
  253.      * @ORM\Column(type="string", length=128, nullable=true)
  254.      * @Assert\Length(max=128)
  255.      * @Assert\NotBlank(groups={"Profile-Complete-Step3"})
  256.      * @EnumAssert(class="App\Enum\UserEmployeeStatus", groups={"Edition-Step3"})
  257.      * @Groups({"user:item", "user:write"})
  258.      */
  259.     private $employeeStatus;
  260.     /**
  261.      * @ORM\Column(type="date", nullable=true)
  262.      * @Assert\NotNull(groups={"Profile-Complete-Step3"})
  263.      * @Assert\LessThan("today")
  264.      * @Groups({"user:item", "user:write"})
  265.      */
  266.     private $birthDate;
  267.     /**
  268.      * @ORM\ManyToOne(targetEntity="App\Entity\FamilyStatus")
  269.      * @ORM\JoinColumn(nullable=true)
  270.      * @Groups({"user:item", "user:write"})
  271.      */
  272.     private $familyStatus;
  273.     /**
  274.      * @ORM\ManyToOne(targetEntity="App\Entity\Gender")
  275.      * @Assert\NotNull(groups={"Profile-Complete-Step3"})
  276.      * @ORM\JoinColumn(nullable=true)
  277.      * @Groups({"user:item", "user:write"})
  278.      */
  279.     private $gender;
  280.     /**
  281.      * @ORM\ManyToOne(targetEntity="App\Entity\MaritalStatus")
  282.      * @Assert\NotNull(groups={"Profile-Complete-Step3"})
  283.      * @ORM\JoinColumn(nullable=true)
  284.      */
  285.     private $maritalStatus;
  286.     /**
  287.      * @ORM\Column(type="string", length=128, nullable=true)
  288.      * @Assert\Length(max=128)
  289.      * @Assert\NotBlank(groups={"GenderOther"})
  290.      * @Groups({"user:item", "user:write"})
  291.      */
  292.     private $genderOther;
  293.     /**
  294.      * @ORM\ManyToOne(targetEntity="App\Entity\Race")
  295.      * @Assert\NotNull(groups={"Profile-Complete-Step3"})
  296.      * @ORM\JoinColumn(nullable=true)
  297.      * @Groups({"user:item", "user:write"})
  298.      */
  299.     private $race;
  300.     /**
  301.      * @ORM\Column(type="string", length=128, nullable=true)
  302.      * @Assert\Length(max=128, groups={"RaceOther"})
  303.      * @Assert\NotBlank(groups={"RaceOther"})
  304.      * @Groups({"user:item", "user:write"})
  305.      */
  306.     private $raceOther;
  307.     /**
  308.      * @ORM\ManyToOne(targetEntity="App\Entity\Ethnicity")
  309.      * @ORM\JoinColumn(nullable=true)
  310.      */
  311.     private $ethnicity;
  312.     /**
  313.      * @ORM\ManyToOne(targetEntity="App\Entity\NativeLanguageStatus")
  314.      * @ORM\JoinColumn(nullable=true)
  315.      * @Groups({"user:item", "user:write"})
  316.      */
  317.     private $nativeLanguageStatus;
  318.     /**
  319.      * @ORM\Column(type="string", length=128, nullable=true)
  320.      * @Assert\Length(max=128, groups={"Profile-Complete-Step3"})
  321.      * @Assert\NotBlank(groups={"Profile-Complete-Step3"})
  322.      * @Groups({"user:item", "user:write"})
  323.      */
  324.     private $nativeLanguageStatusOther;
  325.     /**
  326.      * @ORM\ManyToOne(targetEntity="App\Entity\Religion")
  327.      * @Assert\NotNull(groups={"Profile-Complete-Step3"})
  328.      * @ORM\JoinColumn(nullable=true)
  329.      * @Groups({"user:item", "user:write"})
  330.      */
  331.     private $religion;
  332.     /**
  333.      * @ORM\Column(type="string", length=128, nullable=true)
  334.      * @Assert\Length(max=128, groups={"ReligionOther"})
  335.      * @Assert\NotBlank(groups={"ReligionOther"})
  336.      * @Groups({"user:item", "user:write"})
  337.      */
  338.     private $religionOther;
  339.     /**
  340.      * @ORM\ManyToOne(targetEntity="App\Entity\DisabilityStatus")
  341.      * @ORM\JoinColumn(nullable=true)
  342.      * @Groups({"user:item", "user:write"})
  343.      */
  344.     private $disabilityStatus;
  345.     /**
  346.      * @ORM\Column(type="string", length=128, nullable=true)
  347.      * @Assert\Length(max=128, groups={"DiffenrentlyAbledOther"})
  348.      * @Assert\NotBlank(groups={"DiffenrentlyAbledOther"})
  349.      * @Groups({"user:item", "user:write"})
  350.      */
  351.     private $disabilityStatusOther;
  352.     /**
  353.      * @ORM\ManyToOne(targetEntity="App\Entity\SexualOrientation")
  354.      * @Assert\NotNull(groups={"Profile-Complete-Step3"})
  355.      * @ORM\JoinColumn(nullable=true)
  356.      * @Groups({"user:item", "user:write"})
  357.      */
  358.     private $sexualOrientation;
  359.     /**
  360.      * @ORM\Column(type="string", length=128, nullable=true)
  361.      * @Assert\Length(max=128, groups={"SexualOrientationOther"})
  362.      * @Assert\NotBlank(groups={"SexualOrientationOther"})
  363.      * @Groups({"user:item", "user:write"})
  364.      */
  365.     private $sexualOrientationOther;
  366.     /**
  367.      * @ORM\ManyToOne(targetEntity="App\Entity\TransgenderStatus")
  368.      * @Assert\NotBlank(groups={"Profile-Complete-Step3"})
  369.      * @ORM\JoinColumn(nullable=true)
  370.      * @Groups({"user:item", "user:write"})
  371.      */
  372.     private $transgenderStatus;
  373.     /**
  374.      * @ORM\Column(type="boolean")
  375.      * @Assert\Type("bool")
  376.      * @Groups({"user:item","user:list", "user:write"})
  377.      */
  378.     private $enable;
  379.     /**
  380.      * @ORM\Column(type="boolean")
  381.      * @Assert\Type("bool")
  382.      * @Groups({"user:item", "user:list","user:write"})
  383.      */
  384.     private ?bool $enableWelcome false;
  385.     /**
  386.      * @ORM\Column(type="boolean")
  387.      * @Assert\Type("bool")
  388.      */
  389.     private $viewWelcome;
  390.     /**
  391.      * @ORM\Column(type="boolean")
  392.      * @Assert\Type("bool")
  393.      * @Groups({"user:item", "user:write"})
  394.      */
  395.     private $accessAdminPortal;
  396.     /**
  397.      * @ORM\Column(type="string", length=30, nullable=true)
  398.      * @Groups({"user:item", "user:write"})
  399.      */
  400.     private $role;
  401.     /**
  402.      * @ORM\Column(type="integer", nullable=true)
  403.      * @Groups({"user:item", "user:write"})
  404.      */
  405.     private $nbReviews;
  406.     /**
  407.      * @ORM\OneToMany(targetEntity="App\Entity\Review", cascade={"persist"}, mappedBy="user", orphanRemoval=true)
  408.      * @Assert\Valid()
  409.      */
  410.     private $reviews;
  411.     /**
  412.      * @ORM\OneToMany(targetEntity="App\Entity\UserFollowCompany", mappedBy="user", orphanRemoval=true, cascade={"persist"})
  413.      */
  414.     private $userFollowCompanies;
  415.     /**
  416.      * @ORM\OneToMany(targetEntity="App\Entity\UserLike", mappedBy="user", orphanRemoval=true, cascade={"persist"})
  417.      */
  418.     private $userLikes;
  419.     /**
  420.      * @ORM\OneToMany(targetEntity="App\Entity\Flagged", mappedBy="flagger", orphanRemoval=true, cascade={"persist"})
  421.      */
  422.     private $flaggeds;
  423.     /**
  424.      * @ORM\OneToMany(targetEntity="App\Entity\UserCompany", mappedBy="user", orphanRemoval=true)
  425.      */
  426.     private $userCompanies;
  427.     /**
  428.      * @var ArrayCollection
  429.      *
  430.      * @ORM\ManyToMany(targetEntity="App\Entity\Benefit")
  431.      * @Groups({"user:item", "user:write"})
  432.      */
  433.     private $benefits;
  434.     /**
  435.      * @var ArrayCollection
  436.      *
  437.      * @ORM\ManyToMany(targetEntity="App\Entity\SocialGroupIssue")
  438.      * @Groups({"user:item", "user:write"})
  439.      */
  440.     private $socialGroupIssues;
  441.     /**
  442.      * @var ArrayCollection|Industry[]
  443.      *
  444.      * @ORM\ManyToMany(targetEntity="App\Entity\Industry")
  445.      * @Groups({"user:item", "user:write"})
  446.      */
  447.     private $industries;
  448.     /**
  449.      * @ORM\OneToMany(targetEntity="App\Entity\UserJob", mappedBy="user")
  450.      */
  451.     private $userJobs;
  452.     /**
  453.      * @ORM\Column(type="string", length=20, nullable=true)
  454.      * @Assert\Length(max=20)
  455.      */
  456.     private $yearsInIndustry;
  457.     /**
  458.      * @ORM\Column(type="string", length=20, nullable=true)
  459.      * @Assert\Length(max=20)
  460.      */
  461.     private $tenure;
  462.     /**
  463.      * @var string
  464.      *
  465.      * @ORM\Column(type="string", length=50, nullable=false, columnDefinition="enum('generic', 'genuine')", options={"default": "genuine"})
  466.      * @Groups({"user:item", "user:write"})
  467.      */
  468.     private $userType UserType::GENUINE;
  469.     /**
  470.      * @var ArrayCollection|SurveyContribution[]
  471.      *
  472.      * @ORM\OneToMany(targetEntity="App\Entity\SurveyContribution", mappedBy="user", cascade={"persist"})
  473.      */
  474.     private $surveyContributions;
  475.     /**
  476.      * @var Collection
  477.      *
  478.      * @ORM\OneToMany(targetEntity="App\Entity\UserActivityLog", mappedBy="user", cascade={"persist"})
  479.      */
  480.     private $userActivitylog;
  481.     /**
  482.      * @ORM\ManyToOne(targetEntity="App\Entity\HouseholdIncome")
  483.      * @ORM\JoinColumn(nullable=true)
  484.      */
  485.     private $householdIncome;
  486.     /**
  487.      * @ORM\ManyToOne(targetEntity="App\Entity\CaregiverStatus")
  488.      * @ORM\JoinColumn(nullable=true)
  489.      */
  490.     private $caregiverStatus;
  491.     /**
  492.      * @ORM\ManyToOne(targetEntity="App\Entity\VeteranStatus")
  493.      * @ORM\JoinColumn(nullable=true)
  494.      */
  495.     private $veteranStatus;
  496.     /**
  497.      * @ORM\ManyToOne(targetEntity="App\Entity\Politcs")
  498.      * @ORM\JoinColumn(nullable=true)
  499.      */
  500.     private $politics;
  501.     /**
  502.      * @ORM\ManyToOne(targetEntity="App\Entity\FirstGenerationStatus")
  503.      * @ORM\JoinColumn(nullable=true)
  504.      */
  505.     private $firstGenerationStatus;
  506.     /**
  507.      * @ORM\OneToMany(targetEntity=PinpointCampaignUser::class, mappedBy="user", orphanRemoval=true)
  508.      */
  509.     private $pinpointCampaignUsers;
  510.     /**
  511.      * @ORM\OneToMany(targetEntity=PinpointCampaignQuestion::class, mappedBy="user")
  512.      */
  513.     private $pinpointCampaignQuestions;
  514.     /**
  515.      * @ORM\OneToMany(targetEntity=ScheduleRecipients::class, mappedBy="user", orphanRemoval=true)
  516.      */
  517.     private $scheduleRecipients;
  518.     /**
  519.      * User constructor.
  520.      */
  521.     public function __construct($email)
  522.     {
  523.         $this->email $email;
  524.         $this->address = new Address();
  525.         $this->privacy UserPrivacy::ANONYMOUS;
  526.         $this->confirmationToken null;
  527.         $this->passwordRequestedAt null;
  528.         $this->enable false;
  529.         $this->isUserPassword true;
  530.         $this->nbReviews 0;
  531.         $this->genderOther null;
  532.         $this->raceOther null;
  533.         $this->sexualOrientationOther null;
  534.         $this->religionOther null;
  535.         $this->disabilityStatusOther null;
  536.         $this->nativeLanguageStatusOther null;
  537.         $this->lastLoginAt null;
  538.         $this->workExperiences = new ArrayCollection();
  539.         $this->reviews = new ArrayCollection();
  540.         $this->userFollowCompanies = new ArrayCollection();
  541.         $this->benefits = new ArrayCollection();
  542.         $this->socialGroupIssues = new ArrayCollection();
  543.         $this->industries = new ArrayCollection();
  544.         $this->userLikes = new ArrayCollection();
  545.         $this->seeNotificationAt = new DateTime();
  546.         $this->flaggeds = new ArrayCollection();
  547.         $this->userCompanies = new ArrayCollection();
  548.         $this->surveyContributions = new ArrayCollection();
  549.         $this->userActivitylog = new ArrayCollection();
  550.         $this->enableWelcome false;
  551.         $this->viewWelcome null;
  552.         $this->accessAdminPortal false;
  553.         $this->role null;
  554.         $this->userJobs = new ArrayCollection();
  555.         $this->pinpointCampaignUsers = new ArrayCollection();
  556.         $this->pinpointCampaignQuestions = new ArrayCollection();
  557.         $this->scheduleRecipients = new ArrayCollection();
  558.     }
  559.     public function getId(): ?int
  560.     {
  561.         return $this->id;
  562.     }
  563.     /**
  564.      * @see PasswordAuthenticatedUserInterface
  565.      */
  566.     public function getPassword(): ?string
  567.     {
  568.         return $this->password;
  569.     }
  570.     public function setPassword(string $password): self
  571.     {
  572.         $this->password $password;
  573.         return $this;
  574.     }
  575.     /**
  576.      * Returning a salt is only needed, if you are not using a modern
  577.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  578.      *
  579.      * @see UserInterface
  580.      */
  581.     public function getSalt(): ?string
  582.     {
  583.         return null;
  584.     }
  585.     /**
  586.      * @return mixed
  587.      */
  588.     public function getEmail()
  589.     {
  590.         return $this->email;
  591.     }
  592.     /**
  593.      * @param mixed $email
  594.      */
  595.     public function setEmail($email): void
  596.     {
  597.         $this->email $email;
  598.     }
  599.     public function getUsername(): ?string
  600.     {
  601.         return $this->email;
  602.     }
  603.     /**
  604.      * The public representation of the user (e.g. a email address, etc.).
  605.      *
  606.      * @see UserInterface
  607.      */
  608.     public function getUserIdentifier(): string
  609.     {
  610.         return (string) $this->email;
  611.     }
  612.     /**
  613.      * @see UserInterface
  614.      */
  615.     public function getRoles(): array
  616.     {
  617.         $roles $this->roles;
  618.         // guarantee every user at least has ROLE_USER
  619.         $roles[] = 'ROLE_USER';
  620.         return array_unique($roles);
  621.     }
  622.     public function setRoles(array $roles): self
  623.     {
  624.         $this->roles $roles;
  625.         return $this;
  626.     }
  627.     public function eraseCredentials()
  628.     {
  629.     }
  630.     public function getConfirmationToken(): ?string
  631.     {
  632.         return $this->confirmationToken;
  633.     }
  634.     public function setConfirmationToken(?string $confirmationToken): self
  635.     {
  636.         $this->confirmationToken $confirmationToken;
  637.         return $this;
  638.     }
  639.     public function getUniqueId(): ?string
  640.     {
  641.         return $this->uniqueId;
  642.     }
  643.     public function setUniqueId(?string $uniqueId): self
  644.     {
  645.         $this->uniqueId $uniqueId;
  646.         return $this;
  647.     }
  648.     public function getCompany(): ?Company
  649.     {
  650.         return $this->company;
  651.     }
  652.     public function setCompany(?Company $company): self
  653.     {
  654.         $this->company $company;
  655.         return $this;
  656.     }
  657.     public function getFirstName(): ?string
  658.     {
  659.         return $this->firstName;
  660.     }
  661.     public function setFirstName(string $firstName): self
  662.     {
  663.         $this->firstName $firstName;
  664.         return $this;
  665.     }
  666.     public function getLastName(): ?string
  667.     {
  668.         return $this->lastName;
  669.     }
  670.     public function setLastName(?string $lastName): self
  671.     {
  672.         $this->lastName $lastName;
  673.         return $this;
  674.     }
  675.     public function getIsUserPassword(): ?bool
  676.     {
  677.         return $this->isUserPassword;
  678.     }
  679.     public function setIsUserPassword(bool $isUserPassword): self
  680.     {
  681.         $this->isUserPassword $isUserPassword;
  682.         return $this;
  683.     }
  684.     public function getPasswordRequestedAt(): ?DateTime
  685.     {
  686.         return $this->passwordRequestedAt;
  687.     }
  688.     public function setPasswordRequestedAt(?DateTime $passwordRequestedAt): self
  689.     {
  690.         $this->passwordRequestedAt $passwordRequestedAt;
  691.         return $this;
  692.     }
  693.     /**
  694.      * @return Collection|UserCompany[]
  695.      */
  696.     public function getUserCompanies(): Collection
  697.     {
  698.         return $this->userCompanies;
  699.     }
  700.     public function addUserCompany(UserCompany $userCompany): self
  701.     {
  702.         if (!$this->userCompanies->contains($userCompany)) {
  703.             $this->userCompanies[] = $userCompany;
  704.             $userCompany->setUser($this);
  705.         }
  706.         return $this;
  707.     }
  708.     public function removeUserCompany(UserCompany $userCompany): self
  709.     {
  710.         if ($this->userCompanies->contains($userCompany)) {
  711.             $this->userCompanies->removeElement($userCompany);
  712.             // set the owning side to null (unless already changed)
  713.             if ($userCompany->getUser() === $this) {
  714.                 $userCompany->setUser(null);
  715.             }
  716.         }
  717.         return $this;
  718.     }
  719.     public function getOauthProvider(): ?string
  720.     {
  721.         return $this->oauthProvider;
  722.     }
  723.     public function setOauthProvider(?string $oauthProvider): self
  724.     {
  725.         $this->oauthProvider $oauthProvider;
  726.         return $this;
  727.     }
  728.     public function getOauthUid(): ?string
  729.     {
  730.         return $this->oauthUid;
  731.     }
  732.     public function setOauthUid(?string $oauthUid): self
  733.     {
  734.         $this->oauthUid $oauthUid;
  735.         return $this;
  736.     }
  737.     public function getOauthAccessToken(): ?string
  738.     {
  739.         return $this->oauthAccessToken;
  740.     }
  741.     public function setOauthAccessToken(?string $oauthAccessToken): self
  742.     {
  743.         $this->oauthAccessToken $oauthAccessToken;
  744.         return $this;
  745.     }
  746.     public function getLastLoginAt(): ?DateTime
  747.     {
  748.         return $this->lastLoginAt;
  749.     }
  750.     public function setLastLoginAt(?DateTime $lastLoginAt): self
  751.     {
  752.         $this->lastLoginAt $lastLoginAt;
  753.         return $this;
  754.     }
  755.     public function getSeeNotificationAt(): ?DateTime
  756.     {
  757.         return $this->seeNotificationAt;
  758.     }
  759.     public function setSeeNotificationAt(?DateTime $seeNotificationAt): self
  760.     {
  761.         $this->seeNotificationAt $seeNotificationAt;
  762.         return $this;
  763.     }
  764.     public function getBadge(): ?Badge
  765.     {
  766.         return $this->badge;
  767.     }
  768.     public function setBadge(Badge $badge): self
  769.     {
  770.         $this->badge $badge;
  771.         return $this;
  772.     }
  773.     public function getAddress(): ?Address
  774.     {
  775.         return $this->address;
  776.     }
  777.     public function setAddress(?Address $address): self
  778.     {
  779.         $this->address $address;
  780.         return $this;
  781.     }
  782.     public function getEducationLevel(): ?EducationLevel
  783.     {
  784.         return $this->educationLevel;
  785.     }
  786.     public function setEducationLevel(?EducationLevel $educationLevel): self
  787.     {
  788.         $this->educationLevel $educationLevel;
  789.         return $this;
  790.     }
  791.     public function getPhone(): ?string
  792.     {
  793.         return $this->phone;
  794.     }
  795.     public function setPhone(?string $phone): self
  796.     {
  797.         $this->phone $phone;
  798.         return $this;
  799.     }
  800.     public function setImageFile(File $image null)
  801.     {
  802.         $this->imageFile $image;
  803.         // VERY IMPORTANT:
  804.         // It is required that at least one field changes if you are using Doctrine,
  805.         // otherwise the event listeners won't be called and the file is lost
  806.         if ($image) {
  807.             // if 'updatedAt' is not defined in your entity, use another property
  808.             $this->updatedAt = new \DateTime('now');
  809.         }
  810.     }
  811.     public function getImageFile()
  812.     {
  813.         return $this->imageFile;
  814.     }
  815.     public function setImage($image)
  816.     {
  817.         $this->image $image;
  818.     }
  819.     public function getImage()
  820.     {
  821.         return $this->image;
  822.     }
  823.     public function getPrivacy(): ?string
  824.     {
  825.         return $this->privacy;
  826.     }
  827.     public function setPrivacy(?string $privacy): self
  828.     {
  829.         $this->privacy $privacy;
  830.         return $this;
  831.     }
  832.     public function getGender(): ?Gender
  833.     {
  834.         return $this->gender;
  835.     }
  836.     public function setGender(?Gender $gender): self
  837.     {
  838.         $this->gender $gender;
  839.         return $this;
  840.     }
  841.     public function getRace(): ?Race
  842.     {
  843.         return $this->race;
  844.     }
  845.     public function setRace(?Race $race): self
  846.     {
  847.         $this->race $race;
  848.         return $this;
  849.     }
  850.     public function getEthnticity(): ?Ethnicity
  851.     {
  852.         return $this->ethnicity;
  853.     }
  854.     public function setEthnticity(?Ethnicity $ethnicity): self
  855.     {
  856.         $this->ethnicity $ethnicity;
  857.         return $this;
  858.     }
  859.     public function getSexualOrientation(): ?SexualOrientation
  860.     {
  861.         return $this->sexualOrientation;
  862.     }
  863.     public function setSexualOrientation(?SexualOrientation $sexualOrientation): self
  864.     {
  865.         $this->sexualOrientation $sexualOrientation;
  866.         return $this;
  867.     }
  868.     public function getFirstGenerationStatus(): ?FirstGenerationStatus
  869.     {
  870.         return $this->firstGenerationStatus;
  871.     }
  872.     public function setFirstGenerationStatus(?FirstGenerationStatus $firstGenerationStatus): self
  873.     {
  874.         $this->firstGenerationStatus $firstGenerationStatus;
  875.         return $this;
  876.     }
  877.     public function getVeteranStatus(): ?VeteranStatus
  878.     {
  879.         return $this->veteranStatus;
  880.     }
  881.     public function setVeteranStatus(?VeteranStatus $veteranStatus): self
  882.     {
  883.         $this->veteranStatus $veteranStatus;
  884.         return $this;
  885.     }
  886.     public function getMaritalStatus(): ?MaritalStatus
  887.     {
  888.         return $this->maritalStatus;
  889.     }
  890.     public function setMaritalStatus(?MaritalStatus $maritalStatus): self
  891.     {
  892.         $this->maritalStatus $maritalStatus;
  893.         return $this;
  894.     }
  895.     public function getPolitcs(): ?Politcs
  896.     {
  897.         return $this->politics;
  898.     }
  899.     public function setPolitcs(?Politcs $politics): self
  900.     {
  901.         $this->politics $politics;
  902.         return $this;
  903.     }
  904.     public function getHouseholdIncome(): ?HouseholdIncome
  905.     {
  906.         return $this->householdIncome;
  907.     }
  908.     public function setHouseholdIncome(?HouseholdIncome $householdIncome): self
  909.     {
  910.         $this->householdIncome $householdIncome;
  911.         return $this;
  912.     }
  913.     public function getCaregiverStatus(): ?CaregiverStatus
  914.     {
  915.         return $this->caregiverStatus;
  916.     }
  917.     public function setCaregiverStatus(?CaregiverStatus $caregiverStatus): self
  918.     {
  919.         $this->caregiverStatus $caregiverStatus;
  920.         return $this;
  921.     }
  922.     public function getBirthDate(): ?DateTime
  923.     {
  924.         return $this->birthDate;
  925.     }
  926.     public function setBirthDate(?DateTime $birthDate): self
  927.     {
  928.         $this->birthDate $birthDate;
  929.         return $this;
  930.     }
  931.     public function getFamilyStatus(): ?FamilyStatus
  932.     {
  933.         return $this->familyStatus;
  934.     }
  935.     public function setFamilyStatus(?FamilyStatus $familyStatus): self
  936.     {
  937.         $this->familyStatus $familyStatus;
  938.         return $this;
  939.     }
  940.     public function getReligion(): ?Religion
  941.     {
  942.         return $this->religion;
  943.     }
  944.     public function setReligion(?Religion $religion): self
  945.     {
  946.         $this->religion $religion;
  947.         return $this;
  948.     }
  949.     public function getNativeLanguageStatus(): ?NativeLanguageStatus
  950.     {
  951.         return $this->nativeLanguageStatus;
  952.     }
  953.     public function setNativeLanguageStatus(?NativeLanguageStatus $nativeLanguageStatus): self
  954.     {
  955.         $this->nativeLanguageStatus $nativeLanguageStatus;
  956.         return $this;
  957.     }
  958.     public function getNativeLanguageStatusOther(): ?string
  959.     {
  960.         return $this->nativeLanguageStatusOther;
  961.     }
  962.     public function setNativeLanguageStatusOther(?string $nativeLanguageStatusOther): self
  963.     {
  964.         $this->nativeLanguageStatusOther $nativeLanguageStatusOther;
  965.         return $this;
  966.     }
  967.     public function getEmployeeStatus(): ?string
  968.     {
  969.         return $this->employeeStatus;
  970.     }
  971.     public function setEmployeeStatus(?string $employeeStatus): self
  972.     {
  973.         $this->employeeStatus $employeeStatus;
  974.         return $this;
  975.     }
  976.     public function getDisabilityStatus(): ?DisabilityStatus
  977.     {
  978.         return $this->disabilityStatus;
  979.     }
  980.     public function setDisabilityStatus(?DisabilityStatus $disabilityStatus): self
  981.     {
  982.         $this->disabilityStatus $disabilityStatus;
  983.         return $this;
  984.     }
  985.     public function getDisabilityStatusOther(): ?string
  986.     {
  987.         return $this->disabilityStatusOther;
  988.     }
  989.     public function setDisabilityStatusOther(?string $disabilityStatusOther): self
  990.     {
  991.         $this->disabilityStatusOther $disabilityStatusOther;
  992.         return $this;
  993.     }
  994.     public function getEnable(): ?bool
  995.     {
  996.         return $this->enable;
  997.     }
  998.     public function setEnable(bool $enable): self
  999.     {
  1000.         $this->enable $enable;
  1001.         return $this;
  1002.     }
  1003.     public function getEnableWelcome(): ?bool
  1004.     {
  1005.         return $this->enableWelcome;
  1006.     }
  1007.     public function setEnableWelcome(bool $enableWelcome): self
  1008.     {
  1009.         $this->enableWelcome $enableWelcome;
  1010.         return $this;
  1011.     }
  1012.     public function getViewWelcome(): ?bool
  1013.     {
  1014.         return $this->viewWelcome;
  1015.     }
  1016.     public function setViewWelcome(bool $viewWelcome): self
  1017.     {
  1018.         $this->viewWelcome $viewWelcome;
  1019.         return $this;
  1020.     }
  1021.     public function getAccessAdminPortal(): ?bool
  1022.     {
  1023.         return $this->accessAdminPortal;
  1024.     }
  1025.     public function setAccessAdminPortal(bool $accessAdminPortal): self
  1026.     {
  1027.         $this->accessAdminPortal $accessAdminPortal;
  1028.         return $this;
  1029.     }
  1030.     public function getRole(): ?string
  1031.     {
  1032.         return $this->role;
  1033.     }
  1034.     public function setRole(?string $role): self
  1035.     {
  1036.         $this->role $role;
  1037.         return $this;
  1038.     }
  1039.     public function getUserType(): ?string
  1040.     {
  1041.         return $this->userType;
  1042.     }
  1043.     public function setUserType(string $userType): self
  1044.     {
  1045.         $this->userType $userType;
  1046.         return $this;
  1047.     }
  1048.     /**
  1049.      * @return Collection<int, WorkExperience>
  1050.      */
  1051.     public function getWorkExperiences(): Collection
  1052.     {
  1053.         return $this->workExperiences;
  1054.     }
  1055.     public function addWorkExperience(WorkExperience $workExperience): self
  1056.     {
  1057.         if (!$this->workExperiences->contains($workExperience)) {
  1058.             $this->workExperiences[] = $workExperience;
  1059.             $workExperience->setUser($this);
  1060.         }
  1061.         return $this;
  1062.     }
  1063.     public function removeWorkExperience(WorkExperience $workExperience): self
  1064.     {
  1065.         if ($this->workExperiences->contains($workExperience)) {
  1066.             $this->workExperiences->removeElement($workExperience);
  1067.             // set the owning side to null (unless already changed)
  1068.             if ($workExperience->getUser() === $this) {
  1069.                 $workExperience->setUser(null);
  1070.             }
  1071.         }
  1072.         return $this;
  1073.     }
  1074.     /**
  1075.      * @return Collection|Review[]
  1076.      */
  1077.     public function getReviews(): Collection
  1078.     {
  1079.         return $this->reviews;
  1080.     }
  1081.     public function addReview(Review $review): self
  1082.     {
  1083.         if (!$this->reviews->contains($review)) {
  1084.             $this->reviews[] = $review;
  1085.             $review->setUser($this);
  1086.         }
  1087.         return $this;
  1088.     }
  1089.     public function removeReview(Review $review): self
  1090.     {
  1091.         if ($this->reviews->contains($review)) {
  1092.             $this->reviews->removeElement($review);
  1093.             // set the owning side to null (unless already changed)
  1094.             if ($review->getUser() === $this) {
  1095.                 $review->setUser(null);
  1096.             }
  1097.         }
  1098.         return $this;
  1099.     }
  1100.     public function getNbReviews(): ?int
  1101.     {
  1102.         return $this->nbReviews;
  1103.     }
  1104.     public function setNbReviews(?int $nbReviews): self
  1105.     {
  1106.         $this->nbReviews $nbReviews;
  1107.         return $this;
  1108.     }
  1109.     /**
  1110.      * @return Collection|UserFollowCompany[]
  1111.      */
  1112.     public function getUserFollowCompanies(): Collection
  1113.     {
  1114.         return $this->userFollowCompanies;
  1115.     }
  1116.     public function addUserFollowCompany(UserFollowCompany $userFollowCompany): self
  1117.     {
  1118.         if (!$this->userFollowCompanies->contains($userFollowCompany)) {
  1119.             $this->userFollowCompanies[] = $userFollowCompany;
  1120.             $userFollowCompany->setUser($this);
  1121.         }
  1122.         return $this;
  1123.     }
  1124.     public function removeUserFollowCompany(UserFollowCompany $userFollowCompany): self
  1125.     {
  1126.         if ($this->userFollowCompanies->contains($userFollowCompany)) {
  1127.             $this->userFollowCompanies->removeElement($userFollowCompany);
  1128.             // set the owning side to null (unless already changed)
  1129.             if ($userFollowCompany->getUser() === $this) {
  1130.                 $userFollowCompany->setUser(null);
  1131.             }
  1132.         }
  1133.         return $this;
  1134.     }
  1135.     public function getGenderOther(): ?string
  1136.     {
  1137.         return $this->genderOther;
  1138.     }
  1139.     public function setGenderOther(?string $genderOther): self
  1140.     {
  1141.         $this->genderOther $genderOther;
  1142.         return $this;
  1143.     }
  1144.     /**
  1145.      * @return Collection|Benefit[]
  1146.      */
  1147.     public function getBenefits(): Collection
  1148.     {
  1149.         return $this->benefits;
  1150.     }
  1151.     public function getTransgenderStatus(): ?TransgenderStatus
  1152.     {
  1153.         return $this->transgenderStatus;
  1154.     }
  1155.     public function setTransgenderStatus(?TransgenderStatus $transgenderStatus): self
  1156.     {
  1157.         $this->transgenderStatus $transgenderStatus;
  1158.         return $this;
  1159.     }
  1160.     public function getRaceOther(): ?string
  1161.     {
  1162.         return $this->raceOther;
  1163.     }
  1164.     public function setRaceOther(?string $raceOther): self
  1165.     {
  1166.         $this->raceOther $raceOther;
  1167.         return $this;
  1168.     }
  1169.     public function getSexualOrientationOther(): ?string
  1170.     {
  1171.         return $this->sexualOrientationOther;
  1172.     }
  1173.     public function setSexualOrientationOther(?string $sexualOrientationOther): self
  1174.     {
  1175.         $this->sexualOrientationOther $sexualOrientationOther;
  1176.         return $this;
  1177.     }
  1178.     public function getReligionOther(): ?string
  1179.     {
  1180.         return $this->religionOther;
  1181.     }
  1182.     public function setReligionOther(?string $religionOther): self
  1183.     {
  1184.         $this->religionOther $religionOther;
  1185.         return $this;
  1186.     }
  1187.     public function addBenefit(Benefit $benefit): self
  1188.     {
  1189.         if (!$this->benefits->contains($benefit)) {
  1190.             $this->benefits[] = $benefit;
  1191.         }
  1192.         return $this;
  1193.     }
  1194.     public function removeBenefit(Benefit $benefit): self
  1195.     {
  1196.         if ($this->benefits->contains($benefit)) {
  1197.             $this->benefits->removeElement($benefit);
  1198.         }
  1199.         return $this;
  1200.     }
  1201.     /**
  1202.      * @return Collection|SocialGroupIssue[]
  1203.      */
  1204.     public function getSocialGroupIssues(): Collection
  1205.     {
  1206.         return $this->socialGroupIssues;
  1207.     }
  1208.     public function addSocialGroupIssue(SocialGroupIssue $socialGroupIssue): self
  1209.     {
  1210.         if (!$this->socialGroupIssues->contains($socialGroupIssue)) {
  1211.             $this->socialGroupIssues[] = $socialGroupIssue;
  1212.         }
  1213.         return $this;
  1214.     }
  1215.     public function removeSocialGroupIssue(SocialGroupIssue $socialGroupIssue): self
  1216.     {
  1217.         if ($this->socialGroupIssues->contains($socialGroupIssue)) {
  1218.             $this->socialGroupIssues->removeElement($socialGroupIssue);
  1219.         }
  1220.         return $this;
  1221.     }
  1222.     /**
  1223.      * @return Collection|Industry[]
  1224.      */
  1225.     public function getIndustries(): Collection
  1226.     {
  1227.         return $this->industries;
  1228.     }
  1229.     public function addIndustry(Industry $industry): self
  1230.     {
  1231.         if (!$this->industries->contains($industry)) {
  1232.             $this->industries[] = $industry;
  1233.         }
  1234.         return $this;
  1235.     }
  1236.     public function removeIndustry(Industry $industry): self
  1237.     {
  1238.         if ($this->industries->contains($industry)) {
  1239.             $this->industries->removeElement($industry);
  1240.         }
  1241.         return $this;
  1242.     }
  1243.     public function __toString(): string
  1244.     {
  1245.         return $this->lastName ' ' $this->firstName ' (' $this->getUsername() . ')';
  1246.     }
  1247.     /**
  1248.      * @return Collection<int, PinpointCampaignUser>
  1249.      */
  1250.     public function getPinpointCampaignUsers(): Collection
  1251.     {
  1252.         return $this->pinpointCampaignUsers;
  1253.     }
  1254.     public function addPinpointCampaignUser(PinpointCampaignUser $pinpointCampaignUser): self
  1255.     {
  1256.         if (!$this->pinpointCampaignUsers->contains($pinpointCampaignUser)) {
  1257.             $this->pinpointCampaignUsers[] = $pinpointCampaignUser;
  1258.             $pinpointCampaignUser->setUser($this);
  1259.         }
  1260.         return $this;
  1261.     }
  1262.     public function removePinpointCampaignUser(PinpointCampaignUser $pinpointCampaignUser): self
  1263.     {
  1264.         if ($this->pinpointCampaignUsers->removeElement($pinpointCampaignUser)) {
  1265.             // set the owning side to null (unless already changed)
  1266.             if ($pinpointCampaignUser->getUser() === $this) {
  1267.                 $pinpointCampaignUser->setUser(null);
  1268.             }
  1269.         }
  1270.         return $this;
  1271.     }
  1272.     /**
  1273.      * @return Collection<int, PinpointCampaignQuestion>
  1274.      */
  1275.     public function getPinpointCampaignQuestions(): Collection
  1276.     {
  1277.         return $this->pinpointCampaignQuestions;
  1278.     }
  1279.     #[Groups('user:item')]
  1280.     public function getTotalPinpointCampaignQuestions(): int
  1281.     {
  1282.         return $this->pinpointCampaignQuestions->count();
  1283.     }
  1284.     public function addPinpointCampaignQuestion(PinpointCampaignQuestion $pinpointCampaignQuestion): self
  1285.     {
  1286.         if (!$this->pinpointCampaignQuestions->contains($pinpointCampaignQuestion)) {
  1287.             $this->pinpointCampaignQuestions[] = $pinpointCampaignQuestion;
  1288.             $pinpointCampaignQuestion->setUser($this);
  1289.         }
  1290.         return $this;
  1291.     }
  1292.     public function removePinpointCampaignQuestion(PinpointCampaignQuestion $pinpointCampaignQuestion): self
  1293.     {
  1294.         if ($this->pinpointCampaignQuestions->removeElement($pinpointCampaignQuestion)) {
  1295.             // set the owning side to null (unless already changed)
  1296.             if ($pinpointCampaignQuestion->getUser() === $this) {
  1297.                 $pinpointCampaignQuestion->setUser(null);
  1298.             }
  1299.         }
  1300.         return $this;
  1301.     }
  1302.     /**
  1303.      * @return Collection|<int, SurveyContribution>
  1304.      */
  1305.     public function getSurveyContributions(): Collection
  1306.     {
  1307.         return $this->surveyContributions;
  1308.     }
  1309.     #[Groups('user:item')]
  1310.     public function getTotalContributionQuestion(?PinpointCampaign $pinpointCampaign): int
  1311.     {
  1312.         if ($pinpointCampaign->getId()) {
  1313.             return $this->surveyContributions->filter(function (SurveyContribution $item) use ($pinpointCampaign) {
  1314.                 return $item->getPinpointCampaign() == $pinpointCampaign;
  1315.             })->count();
  1316.         } else {
  1317.             return $this->surveyContributions->count();
  1318.         }
  1319.     }
  1320.     #[Groups('user:item')]
  1321.     public function getContributionCreatedAt(): ?DateTime
  1322.     {
  1323.         return $this->surveyContributions->count() ? $this->surveyContributions[0]->getCreatedAt() : null;
  1324.     }
  1325.     #[Groups('user:item')]
  1326.     public function getContributionStatus(): ?string
  1327.     {
  1328.         $isDraft false;
  1329.         foreach ($this->surveyContributions as $surveyContribution) {
  1330.             foreach ($surveyContribution->getContributionSteps() as $surveyStep) {
  1331.                 foreach ($surveyStep->getContributionQuestions() as $question) {
  1332.                     $isDraft $question->getIsDraft();
  1333.                 }
  1334.             }
  1335.         }
  1336.         if ($isDraft) {
  1337.             return 'Submitted As Draft on';
  1338.         }
  1339.         return $this->surveyContributions->count() ? ucwords($this->surveyContributions[0]->getStatus()) . ' on' '';
  1340.     }
  1341.     public function addSurveyContribution(SurveyContribution $surveyContribution): self
  1342.     {
  1343.         if (!$this->surveyContributions->contains($surveyContribution)) {
  1344.             $this->surveyContributions[] = $surveyContribution;
  1345.             $surveyContribution->setUser($this);
  1346.         }
  1347.         return $this;
  1348.     }
  1349.     public function removeSurveyContribution(SurveyContribution $surveyContribution): self
  1350.     {
  1351.         if ($this->surveyContributions->contains($surveyContribution)) {
  1352.             $this->surveyContributions->removeElement($surveyContribution);
  1353.             // set the owning side to null (unless already changed)
  1354.             if ($surveyContribution->getUser() === $this) {
  1355.                 $surveyContribution->setUser(null);
  1356.             }
  1357.         }
  1358.         return $this;
  1359.     }
  1360.     /**
  1361.      * @return Collection|UserActivityLog[]
  1362.      */
  1363.     public function getUserActivityLog(): Collection
  1364.     {
  1365.         return $this->userActivitylog;
  1366.     }
  1367.     public function addUserActivityLog(UserActivityLog $userActivitylog): self
  1368.     {
  1369.         if (!$this->userActivitylog->contains($userActivitylog)) {
  1370.             $this->userActivitylog[] = $userActivitylog;
  1371.             $userActivitylog->setUser($this);
  1372.         }
  1373.         return $this;
  1374.     }
  1375.     public function removeUserActivityLog(UserActivityLog $userActivitylog): self
  1376.     {
  1377.         if ($this->userActivitylog->contains($userActivitylog)) {
  1378.             $this->userActivitylog->removeElement($userActivitylog);
  1379.             // set the owning side to null (unless already changed)
  1380.             if ($userActivitylog->getUser() === $this) {
  1381.                 $userActivitylog->setUser(null);
  1382.             }
  1383.         }
  1384.         return $this;
  1385.     }
  1386.     #[Groups(['user:item''user:list'"campaignSchedule:read"])]
  1387.     public function getFullNameWithEmail(): string
  1388.     {
  1389.         return $this->lastName ' ' $this->firstName ' (' $this->getUsername() . ')';
  1390.     }
  1391.     #[Groups(["user:item""user:list"])]
  1392.     public function getCreatedAt(): ?\DateTimeInterface
  1393.     {
  1394.         return $this->createdAt ?? null;
  1395.     }
  1396.     #[Groups('user:item')]
  1397.     public function getUpdatedAt(): ?\DateTimeInterface
  1398.     {
  1399.         return $this->updatedAt;
  1400.     }
  1401.     /**
  1402.      * @return Collection<int, ScheduleRecipients>
  1403.      */
  1404.     public function getScheduleRecipients(): Collection
  1405.     {
  1406.         return $this->scheduleRecipients;
  1407.     }
  1408.     public function addScheduleRecipient(ScheduleRecipients $scheduleRecipient): self
  1409.     {
  1410.         if (!$this->scheduleRecipients->contains($scheduleRecipient)) {
  1411.             $this->scheduleRecipients[] = $scheduleRecipient;
  1412.             $scheduleRecipient->setUser($this);
  1413.         }
  1414.         return $this;
  1415.     }
  1416.     public function removeScheduleRecipient(ScheduleRecipients $scheduleRecipient): self
  1417.     {
  1418.         if ($this->scheduleRecipients->removeElement($scheduleRecipient)) {
  1419.             // set the owning side to null (unless already changed)
  1420.             if ($scheduleRecipient->getUser() === $this) {
  1421.                 $scheduleRecipient->setUser(null);
  1422.             }
  1423.         }
  1424.         return $this;
  1425.     }
  1426. }