Skip to content
Snippets Groups Projects
JobApplication.php 9.05 KiB
<?php

namespace SGalinski\SgJobs\Domain\Model;

/***************************************************************
 *  Copyright notice
 *
 *  (c) sgalinski Internet Services (https://www.sgalinski.de)
 *
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
 *
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

/**
 * The JobApplication model
 */
class JobApplication extends AbstractEntity {
	/**
	 * An internal id for external purposes
	 *
	 * @var string $jobId
	 */
	protected $jobId = '';

	/**
	 * @var string $jobTitle
	 */
	protected $jobTitle = '';

	/**
	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SGalinski\SgJobs\Domain\Model\Company>
	 * @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
	 */
	protected $company = '';

	/**
	 * @var \SGalinski\SgJobs\Domain\Model\Job $job
	 */
	protected $job;

	/**
	 * @var string $gender
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $gender = '';

	/**
	 * @var string $firstName
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $firstName = '';

	/**
	 * @var string $lastName
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $lastName = '';

	/**
	 * @var string $street
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $street = '';

	/**
	 * @var string $city
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $city = '';

	/**
	 * @var string $zip
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $zip = '';

	/**
	 * @var string $country
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $country = '';

	/**
	 * @var string $nationality
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $nationality = '';

	/**
	 * @var string $education
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $education = '';

	/**
	 * @var string $birthDate
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $birthDate = '';

	/**
	 * @var string $phone
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 */
	protected $phone = '';

	/**
	 * @var string $mobile
	 */
	protected $mobile = '';

	/**
	 * @var string $email
	 * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
	 * @TYPO3\CMS\Extbase\Annotation\Validate("EmailAddress")
	 */
	protected $email = '';

	/**
	 * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference $coverLetter
	 */
	protected $coverLetter;

	/**
	 * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference $cv
	 */
	protected $cv;

	/**
	 * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference $certificate
	 */
	protected $certificate;

	/**
	 * @var string
	 */
	protected $message = '';

	/**
	 * @var bool
	 * @TYPO3\CMS\Extbase\Annotation\Validate("Boolean", options={"is": TRUE})
	 */
	protected $privacyPolicy = FALSE;

	/**
	 * Job application constructor.
	 */
	public function __construct() {
		$this->company = new ObjectStorage();
	}

	/**
	 * @return string
	 */
	public function getJobId() {
		return $this->jobId;
	}

	/**
	 * @param string $jobId
	 */
	public function setJobId($jobId) {
		$this->jobId = $jobId;
	}

	/**
	 * @return string
	 */
	public function getGender() {
		return $this->gender;
	}

	/**
	 * @param string $gender
	 */
	public function setGender(string $gender) {
		$this->gender = $gender;
	}

	/**
	 * @return string
	 */
	public function getFirstName() {
		return $this->firstName;
	}

	/**
	 * @param string $firstName
	 */
	public function setFirstName(string $firstName) {
		$this->firstName = $firstName;
	}

	/**
	 * @return string
	 */
	public function getLastName() {
		return $this->lastName;
	}

	/**
	 * @param string $lastName
	 */
	public function setLastName(string $lastName) {
		$this->lastName = $lastName;
	}

	/**
	 * @return string
	 */
	public function getStreet() {
		return $this->street;
	}

	/**
	 * @param string $street
	 */
	public function setStreet(string $street) {
		$this->street = $street;
	}

	/**
	 * @return string
	 */
	public function getCity() {
		return $this->city;
	}

	/**
	 * @param string $city
	 */
	public function setCity(string $city) {
		$this->city = $city;
	}

	/**
	 * @return string
	 */
	public function getZip() {
		return $this->zip;
	}

	/**
	 * @param string $zip
	 */
	public function setZip(string $zip) {
		$this->zip = $zip;
	}

	/**
	 * @return string
	 */
	public function getCountry() {
		return $this->country;
	}

	/**
	 * @param string $country
	 */
	public function setCountry(string $country) {
		$this->country = $country;
	}

	/**
	 * @return string
	 */
	public function getNationality() {
		return $this->nationality;
	}

	/**
	 * @param string $nationality
	 */
	public function setNationality(string $nationality) {
		$this->nationality = $nationality;
	}

	/**
	 * @return string
	 */
	public function getEducation() {
		return $this->education;
	}

	/**
	 * @param string $education
	 */
	public function setEducation(string $education) {
		$this->education = $education;
	}

	/**
	 * @return string
	 */
	public function getBirthDate() {
		return $this->birthDate;
	}

	/**
	 * @param string $birthDate
	 */
	public function setBirthDate($birthDate) {
		$this->birthDate = $birthDate;
	}

	/**
	 * @return string
	 */
	public function getPhone() {
		return $this->phone;
	}

	/**
	 * @param string $phone
	 */
	public function setPhone(string $phone) {
		$this->phone = $phone;
	}

	/**
	 * @return string
	 */
	public function getMobile() {
		return $this->mobile;
	}

	/**
	 * @param string $mobile
	 */
	public function setMobile(string $mobile) {
		$this->mobile = $mobile;
	}

	/**
	 * @return string
	 */
	public function getEmail() {
		return $this->email;
	}

	/**
	 * @param string $email
	 */
	public function setEmail(string $email) {
		$this->email = $email;
	}

	/**
	 * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference
	 */
	public function getCoverLetter() {
		return $this->coverLetter;
	}

	/**
	 * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $coverLetter
	 */
	public function setCoverLetter(\TYPO3\CMS\Extbase\Domain\Model\FileReference $coverLetter = NULL) {
		$this->coverLetter = $coverLetter;
	}

	/**
	 * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference
	 */
	public function getCv() {
		return $this->cv;
	}

	/**
	 * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $cv
	 */
	public function setCV(\TYPO3\CMS\Extbase\Domain\Model\FileReference $cv = NULL) {
		$this->cv = $cv;
	}

	/**
	 * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference
	 */
	public function getCertificate() {
		return $this->certificate;
	}

	/**
	 * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $certificate
	 */
	public function setCertificate(\TYPO3\CMS\Extbase\Domain\Model\FileReference $certificate = NULL) {
		$this->certificate = $certificate;
	}

	/**
	 * @return string
	 */
	public function getMessage() {
		return $this->message;
	}

	/**
	 * @param string $message
	 */
	public function setMessage(string $message) {
		$this->message = $message;
	}

	/**
	 * @return string
	 */
	public function getJobTitle(): string {
		return $this->jobTitle;
	}

	/**
	 * @param string $jobTitle
	 */
	public function setJobTitle(string $jobTitle) {
		$this->jobTitle = $jobTitle;
	}

	/**
	 * @return \SGalinski\SgJobs\Domain\Model\Job
	 */
	public function getJob() {
		return $this->job;
	}

	/**
	 * @param \SGalinski\SgJobs\Domain\Model\Job $job
	 */
	public function setJob(Job $job) {
		$this->job = $job;
	}

	/**
	 * @return Company|NULL
	 */
	public function getCompany() {
		if ($this->company instanceof LazyLoadingProxy) {
			$this->company->_loadRealInstance();
		}

		if ($this->company->count() === 0) {
			return NULL;
		}
		return $this->company->offsetGet(0);
	}

	/**
	 * @return ObjectStorage
	 */
	public function getCompanies(): ObjectStorage {
		if ($this->company instanceof LazyLoadingProxy) {
			$this->company->_loadRealInstance();
		}

		return $this->company;
	}

	/**
	 * @param Company|ObjectStorage $company
	 */
	public function setCompany($company): void {
		if ($company instanceof Company) {
			$this->company->attach($company);
		} else {
			$this->company = $company;
		}
	}

	/**
	 * @return bool
	 */
	public function getPrivacyPolicy() {
		return $this->privacyPolicy;
	}

	/**
	 * @param bool $privacyPolicy
	 */
	public function setPrivacyPolicy($privacyPolicy) {
		$this->privacyPolicy = $privacyPolicy;
	}
}