<?php
namespace App\CIC\Model\Student;
use App\Entity\School\Student\StudentProfile;
class StudentProfileModel implements \Serializable, \JsonSerializable
{
private $IDNUM;
private $uuid;
private $LASTN;
private $FIRSTN;
private $MIDDLEN;
private $DR;
private $SEX;
private $DBIRTH;
private $CITIZ;
private $LADD1;
private $LADD2;
private $LCITY;
private $LPRO;
private $HADD1;
private $HADD2;
private $HCITY;
private $STATE;
private $ORIGIN;
private $HPHONE;
private $LASTSCH;
private $LASTSCH_CITY;
private $YR_ARRIVAL;
private $AGENT_NAME;
private $HOME_FAX;
private $STU_MAIL;
private $STU_MAIL_ALT;
private $applicant_id;
private $applicant_uuid;
public function __construct($data=[])
{
if(!empty($data))
$this->unserialize($data);
}
/**
* @return mixed
*/
public function getIDNUM()
{
return $this->IDNUM;
}
/**
* @param mixed $IDNUM
*
* @return StudentProfileModel
*/
public function setIDNUM($IDNUM)
{
$this->IDNUM = $IDNUM;
return $this;
}
/**
* @return mixed
*/
public function getUuid()
{
return $this->uuid;
}
/**
* @param mixed $uuid
*
* @return StudentProfileModel
*/
public function setUuid($uuid)
{
$this->uuid = $uuid;
return $this;
}
/**
* @return mixed
*/
public function getLASTN()
{
return $this->LASTN;
}
/**
* @param mixed $LASTN
*
* @return StudentProfileModel
*/
public function setLASTN($LASTN)
{
$this->LASTN = $LASTN;
return $this;
}
/**
* @return mixed
*/
public function getFIRSTN()
{
return $this->FIRSTN;
}
/**
* @param mixed $FIRSTN
*
* @return StudentProfileModel
*/
public function setFIRSTN($FIRSTN)
{
$this->FIRSTN = $FIRSTN;
return $this;
}
/**
* @return mixed
*/
public function getMIDDLEN()
{
return $this->MIDDLEN;
}
/**
* @param mixed $MIDDLEN
*
* @return StudentProfileModel
*/
public function setMIDDLEN($MIDDLEN)
{
$this->MIDDLEN = $MIDDLEN;
return $this;
}
/**
* @return mixed
*/
public function getDR()
{
return $this->DR;
}
/**
* @param mixed $DR
*
* @return StudentProfileModel
*/
public function setDR($DR)
{
$this->DR = $DR;
return $this;
}
/**
* @return mixed
*/
public function getSEX()
{
return $this->SEX;
}
/**
* @param mixed $SEX
*
* @return StudentProfileModel
*/
public function setSEX($SEX)
{
$this->SEX = $SEX;
return $this;
}
/**
* @return mixed
*/
public function getDBIRTH()
{
return $this->DBIRTH;
}
/**
* @param mixed $DBIRTH
*
* @return StudentProfileModel
*/
public function setDBIRTH($DBIRTH)
{
$this->DBIRTH = $DBIRTH;
return $this;
}
/**
* @return mixed
*/
public function getCITIZ()
{
return $this->CITIZ;
}
/**
* @param mixed $CITIZ
*
* @return StudentProfileModel
*/
public function setCITIZ($CITIZ)
{
$this->CITIZ = $CITIZ;
return $this;
}
/**
* @return mixed
*/
public function getLADD1()
{
return $this->LADD1;
}
/**
* @param mixed $LADD1
*
* @return StudentProfileModel
*/
public function setLADD1($LADD1)
{
$this->LADD1 = $LADD1;
return $this;
}
/**
* @return mixed
*/
public function getLADD2()
{
return $this->LADD2;
}
/**
* @param mixed $LADD2
*
* @return StudentProfileModel
*/
public function setLADD2($LADD2)
{
$this->LADD2 = $LADD2;
return $this;
}
/**
* @return mixed
*/
public function getLCITY()
{
return $this->LCITY;
}
/**
* @param mixed $LCITY
*
* @return StudentProfileModel
*/
public function setLCITY($LCITY)
{
$this->LCITY = $LCITY;
return $this;
}
/**
* @return mixed
*/
public function getLPRO()
{
return $this->LPRO;
}
/**
* @param mixed $LPRO
*
* @return StudentProfileModel
*/
public function setLPRO($LPRO)
{
$this->LPRO = $LPRO;
return $this;
}
/**
* @return mixed
*/
public function getHADD1()
{
return $this->HADD1;
}
/**
* @param mixed $HADD1
*
* @return StudentProfileModel
*/
public function setHADD1($HADD1)
{
$this->HADD1 = $HADD1;
return $this;
}
/**
* @return mixed
*/
public function getHADD2()
{
return $this->HADD2;
}
/**
* @param mixed $HADD2
*
* @return StudentProfileModel
*/
public function setHADD2($HADD2)
{
$this->HADD2 = $HADD2;
return $this;
}
/**
* @return mixed
*/
public function getHCITY()
{
return $this->HCITY;
}
/**
* @param mixed $HCITY
*
* @return StudentProfileModel
*/
public function setHCITY($HCITY)
{
$this->HCITY = $HCITY;
return $this;
}
/**
* @return mixed
*/
public function getSTATE()
{
return $this->STATE;
}
/**
* @param mixed $STATE
*
* @return StudentProfileModel
*/
public function setSTATE($STATE)
{
$this->STATE = $STATE;
return $this;
}
/**
* @return mixed
*/
public function getORIGIN()
{
return $this->ORIGIN;
}
/**
* @param mixed $ORIGIN
*
* @return StudentProfileModel
*/
public function setORIGIN($ORIGIN)
{
$this->ORIGIN = $ORIGIN;
return $this;
}
/**
* @return mixed
*/
public function getHPHONE()
{
return $this->HPHONE;
}
/**
* @param mixed $HPHONE
*
* @return StudentProfileModel
*/
public function setHPHONE($HPHONE)
{
$this->HPHONE = $HPHONE;
return $this;
}
/**
* @return mixed
*/
public function getLASTSCH()
{
return $this->LASTSCH;
}
/**
* @param mixed $LASTSCH
*
* @return StudentProfileModel
*/
public function setLASTSCH($LASTSCH)
{
$this->LASTSCH = $LASTSCH;
return $this;
}
/**
* @return mixed
*/
public function getLASTSCHCITY()
{
return $this->LASTSCH_CITY;
}
/**
* @param mixed $LASTSCH_CITY
*
* @return StudentProfileModel
*/
public function setLASTSCHCITY($LASTSCH_CITY)
{
$this->LASTSCH_CITY = $LASTSCH_CITY;
return $this;
}
/**
* @return mixed
*/
public function getYRARRIVAL()
{
return $this->YR_ARRIVAL;
}
/**
* @param mixed $YR_ARRIVAL
*
* @return StudentProfileModel
*/
public function setYRARRIVAL($YR_ARRIVAL)
{
$this->YR_ARRIVAL = $YR_ARRIVAL;
return $this;
}
/**
* @return mixed
*/
public function getAGENTNAME()
{
return $this->AGENT_NAME;
}
/**
* @param mixed $AGENT_NAME
*
* @return StudentProfileModel
*/
public function setAGENTNAME($AGENT_NAME)
{
$this->AGENT_NAME = $AGENT_NAME;
return $this;
}
/**
* @return mixed
*/
public function getHOMEFAX()
{
return $this->HOME_FAX;
}
/**
* @param mixed $HOME_FAX
*
* @return StudentProfileModel
*/
public function setHOMEFAX($HOME_FAX)
{
$this->HOME_FAX = $HOME_FAX;
return $this;
}
/**
* @return mixed
*/
public function getSTUMAIL()
{
return $this->STU_MAIL;
}
/**
* @param mixed $STU_MAIL
*
* @return StudentProfileModel
*/
public function setSTUMAIL($STU_MAIL)
{
$this->STU_MAIL = $STU_MAIL;
return $this;
}
/**
* @return mixed
*/
public function getSTUMAILALT()
{
return $this->STU_MAIL_ALT;
}
/**
* @param mixed $STU_MAIL_ALT
*
* @return StudentProfileModel
*/
public function setSTUMAILALT($STU_MAIL_ALT)
{
$this->STU_MAIL_ALT = $STU_MAIL_ALT;
return $this;
}
/**
* @return mixed
*/
public function getApplicantId()
{
return $this->applicant_id;
}
/**
* @param mixed $applicant_id
*
* @return StudentProfileModel
*/
public function setApplicantId($applicant_id)
{
$this->applicant_id = $applicant_id;
return $this;
}
/**
* @return mixed
*/
public function getApplicantUuid()
{
return $this->applicant_uuid;
}
/**
* @param mixed $applicant_uuid
*
* @return StudentProfileModel
*/
public function setApplicantUuid($applicant_uuid)
{
$this->applicant_uuid = $applicant_uuid;
return $this;
}
function loadFromEntity(StudentProfile $student)
{
$this
->setIDNUM($student->getStudentNumber())
->setLASTN($student->getLastName())
->setFIRSTN($student->getGivenName())
->setMIDDLEN($student->getMiddleName())
// ->setDR()
->setSEX($student->getGender())
->setDBIRTH($student->getDateOfBirth()->format("Y-m-d"))
->setCITIZ($student->getCitizenship())
// ->setLADD1()
// ->setLADD2()
// ->setLCITY()
// ->setLPRO()
->setHADD1($student->getHomeAddress())
->setHADD2($student->getHomeAddress2())
->setHCITY($student->getHomeCity())
->setSTATE($student->getHomeProvince())
->setORIGIN($student->getHomeCountry())
->setHPHONE($student->getPhone())
// ->setHOME_FAX($student->getF)
->setSTUMAIL($student->getEmail())
->setSTUMAILALT($student->getAlternateEmailAddress())
// ->setLASTSCH($student->getLa)
// ->setLASTSCH_CITY()
// ->setYR_ARRIVAL()
// ->setAGENT_NAME()
->setApplicantId($student->getApplicantNumber())
->setApplicantUuid($student->getApplicantUuid());
}
function loadFromArray($array)
{
if (array_key_exists('IDNUM', $array))
$this->setIDNUM($array['IDNUM']);
if (array_key_exists('LASTN', $array))
$this->setLASTN($array['LASTN']);
if (array_key_exists('FIRSTN', $array))
$this->setFIRSTN($array['FIRSTN']);
if (array_key_exists('MIDDLEN', $array))
$this->setMIDDLEN($array['MIDDLEN']);
if (array_key_exists('SEX', $array))
$this->setSEX($array['SEX']);
if (array_key_exists('CITIZ', $array))
$this->setCITIZ($array['CITIZ']);
if (array_key_exists('HADD1', $array))
$this->setHADD1($array['HADD1']);
if (array_key_exists('HADD2', $array))
$this->setHADD2($array['HADD2']);
if (array_key_exists('HCITY', $array))
$this->setHCITY($array['HCITY']);
if (array_key_exists('STATE', $array))
$this->setState($array['STATE']);
if (array_key_exists('ORIGIN', $array))
$this->setORIGIN($array['ORIGIN']);
if (array_key_exists('HPHONE', $array))
$this->setHPHONE($array['HPHONE']);
if (array_key_exists('STU_MAIL', $array))
$this->setSTUMAIL($array['STU_MAIL']);
if (array_key_exists('STU_MAIL_ALT', $array))
$this->setSTUMAILALT($array['STU_MAIL_ALT']);
if (array_key_exists('applicant_id', $array))
$this->setApplicantId($array['applicant_id']);
if (array_key_exists('applicant_uuid', $array))
$this->setApplicantUuid($array['applicant_uuid']);;
}
public function jsonSerialize() :mixed
{
return $this->serialize();
}
public function __serialize(): array
{
return $this->serialize();
}
public function serialize(): array
{
$data = [];
foreach (get_object_vars($this) as $key => $val) {
$data[$key] = $val;
}
return $data;
}
public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
public function unserialize($serialized)
{
// Using the KEYS to match the legacy DB columns meant that each field had to be
// set by hand due to the inconsistencies in naming
$this->loadFromArray($serialized);
// foreach ($serialized as $key => $val) {
// $prop = $this->snakeToCamel($key);
// $f = "set" . ucfirst($prop);
// if (method_exists($this, $f)) {
// $this->$f($val);
// }
// }
}
function camel_to_snake($input)
{
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
function snakeToCamel($input)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
// return lcfirst(str_replace('', '', ucwords($input, '')));
}
//convert ProperyName to LegacyDB field, to ease Readabiliy, and clean up code
// Not implmented
//
// TODO buildup legacyKey method to stream line code
function getLegacyKey(string $property) {
switch($property) {
default:
return strtoupper($property); //Simply Upper
break;
case 'uuid':
return $property; //Leave as Is
break;
case 'EXAMPLE':
return 'EXAMPLE';
break;
}
}
}
//class Parent1
//{
// private $FATHER;
// private $DAD_FAX;
// private $DAD_CELL;
// private $DAD_WORK;
// private $DAD_MAIL;
// private $DAD_MAIL_ALT;
// private $parent1_uuid;
//
//}
//
//class Parent2
//{
// private $MOTHER;
// private $MOM_FAX;
// private $MOM_CELL;
// private $MOM_WORK;
// private $MOM_MAIL;
// private $MOM_MAIL_ALT;
// private $parent2_uuid;
//
//
//}
/*
*
*/