src/CIC/Model/Student/StudentProfileModel.php line 665

Open in your IDE?
  1. <?php
  2. namespace App\CIC\Model\Student;
  3. use App\Entity\School\Student\StudentProfile;
  4. class StudentProfileModel implements  \Serializable\JsonSerializable
  5. {
  6.     private $IDNUM;
  7.     private $uuid;
  8.     private $LASTN;
  9.     private $FIRSTN;
  10.     private $MIDDLEN;
  11.     private $DR;
  12.     private $SEX;
  13.     private $DBIRTH;
  14.     private $CITIZ;
  15.     private $LADD1;
  16.     private $LADD2;
  17.     private $LCITY;
  18.     private $LPRO;
  19.     private $HADD1;
  20.     private $HADD2;
  21.     private $HCITY;
  22.     private $STATE;
  23.     private $ORIGIN;
  24.     private $HPHONE;
  25.     private $LASTSCH;
  26.     private $LASTSCH_CITY;
  27.     private $YR_ARRIVAL;
  28.     private $AGENT_NAME;
  29.     private $HOME_FAX;
  30.     private $STU_MAIL;
  31.     private $STU_MAIL_ALT;
  32.     private $applicant_id;
  33.     private $applicant_uuid;
  34.     public function __construct($data=[])
  35.     {
  36.         if(!empty($data))
  37.             $this->unserialize($data);
  38.     }
  39.     /**
  40.      * @return mixed
  41.      */
  42.     public function getIDNUM()
  43.     {
  44.         return $this->IDNUM;
  45.     }
  46.     /**
  47.      * @param mixed $IDNUM
  48.      *
  49.      * @return StudentProfileModel
  50.      */
  51.     public function setIDNUM($IDNUM)
  52.     {
  53.         $this->IDNUM $IDNUM;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return mixed
  58.      */
  59.     public function getUuid()
  60.     {
  61.         return $this->uuid;
  62.     }
  63.     /**
  64.      * @param mixed $uuid
  65.      *
  66.      * @return StudentProfileModel
  67.      */
  68.     public function setUuid($uuid)
  69.     {
  70.         $this->uuid $uuid;
  71.         return $this;
  72.     }
  73.     /**
  74.      * @return mixed
  75.      */
  76.     public function getLASTN()
  77.     {
  78.         return $this->LASTN;
  79.     }
  80.     /**
  81.      * @param mixed $LASTN
  82.      *
  83.      * @return StudentProfileModel
  84.      */
  85.     public function setLASTN($LASTN)
  86.     {
  87.         $this->LASTN $LASTN;
  88.         return $this;
  89.     }
  90.     /**
  91.      * @return mixed
  92.      */
  93.     public function getFIRSTN()
  94.     {
  95.         return $this->FIRSTN;
  96.     }
  97.     /**
  98.      * @param mixed $FIRSTN
  99.      *
  100.      * @return StudentProfileModel
  101.      */
  102.     public function setFIRSTN($FIRSTN)
  103.     {
  104.         $this->FIRSTN $FIRSTN;
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return mixed
  109.      */
  110.     public function getMIDDLEN()
  111.     {
  112.         return $this->MIDDLEN;
  113.     }
  114.     /**
  115.      * @param mixed $MIDDLEN
  116.      *
  117.      * @return StudentProfileModel
  118.      */
  119.     public function setMIDDLEN($MIDDLEN)
  120.     {
  121.         $this->MIDDLEN $MIDDLEN;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return mixed
  126.      */
  127.     public function getDR()
  128.     {
  129.         return $this->DR;
  130.     }
  131.     /**
  132.      * @param mixed $DR
  133.      *
  134.      * @return StudentProfileModel
  135.      */
  136.     public function setDR($DR)
  137.     {
  138.         $this->DR $DR;
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return mixed
  143.      */
  144.     public function getSEX()
  145.     {
  146.         return $this->SEX;
  147.     }
  148.     /**
  149.      * @param mixed $SEX
  150.      *
  151.      * @return StudentProfileModel
  152.      */
  153.     public function setSEX($SEX)
  154.     {
  155.         $this->SEX $SEX;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return mixed
  160.      */
  161.     public function getDBIRTH()
  162.     {
  163.         return $this->DBIRTH;
  164.     }
  165.     /**
  166.      * @param mixed $DBIRTH
  167.      *
  168.      * @return StudentProfileModel
  169.      */
  170.     public function setDBIRTH($DBIRTH)
  171.     {
  172.         $this->DBIRTH $DBIRTH;
  173.         return $this;
  174.     }
  175.     /**
  176.      * @return mixed
  177.      */
  178.     public function getCITIZ()
  179.     {
  180.         return $this->CITIZ;
  181.     }
  182.     /**
  183.      * @param mixed $CITIZ
  184.      *
  185.      * @return StudentProfileModel
  186.      */
  187.     public function setCITIZ($CITIZ)
  188.     {
  189.         $this->CITIZ $CITIZ;
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return mixed
  194.      */
  195.     public function getLADD1()
  196.     {
  197.         return $this->LADD1;
  198.     }
  199.     /**
  200.      * @param mixed $LADD1
  201.      *
  202.      * @return StudentProfileModel
  203.      */
  204.     public function setLADD1($LADD1)
  205.     {
  206.         $this->LADD1 $LADD1;
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return mixed
  211.      */
  212.     public function getLADD2()
  213.     {
  214.         return $this->LADD2;
  215.     }
  216.     /**
  217.      * @param mixed $LADD2
  218.      *
  219.      * @return StudentProfileModel
  220.      */
  221.     public function setLADD2($LADD2)
  222.     {
  223.         $this->LADD2 $LADD2;
  224.         return $this;
  225.     }
  226.     /**
  227.      * @return mixed
  228.      */
  229.     public function getLCITY()
  230.     {
  231.         return $this->LCITY;
  232.     }
  233.     /**
  234.      * @param mixed $LCITY
  235.      *
  236.      * @return StudentProfileModel
  237.      */
  238.     public function setLCITY($LCITY)
  239.     {
  240.         $this->LCITY $LCITY;
  241.         return $this;
  242.     }
  243.     /**
  244.      * @return mixed
  245.      */
  246.     public function getLPRO()
  247.     {
  248.         return $this->LPRO;
  249.     }
  250.     /**
  251.      * @param mixed $LPRO
  252.      *
  253.      * @return StudentProfileModel
  254.      */
  255.     public function setLPRO($LPRO)
  256.     {
  257.         $this->LPRO $LPRO;
  258.         return $this;
  259.     }
  260.     /**
  261.      * @return mixed
  262.      */
  263.     public function getHADD1()
  264.     {
  265.         return $this->HADD1;
  266.     }
  267.     /**
  268.      * @param mixed $HADD1
  269.      *
  270.      * @return StudentProfileModel
  271.      */
  272.     public function setHADD1($HADD1)
  273.     {
  274.         $this->HADD1 $HADD1;
  275.         return $this;
  276.     }
  277.     /**
  278.      * @return mixed
  279.      */
  280.     public function getHADD2()
  281.     {
  282.         return $this->HADD2;
  283.     }
  284.     /**
  285.      * @param mixed $HADD2
  286.      *
  287.      * @return StudentProfileModel
  288.      */
  289.     public function setHADD2($HADD2)
  290.     {
  291.         $this->HADD2 $HADD2;
  292.         return $this;
  293.     }
  294.     /**
  295.      * @return mixed
  296.      */
  297.     public function getHCITY()
  298.     {
  299.         return $this->HCITY;
  300.     }
  301.     /**
  302.      * @param mixed $HCITY
  303.      *
  304.      * @return StudentProfileModel
  305.      */
  306.     public function setHCITY($HCITY)
  307.     {
  308.         $this->HCITY $HCITY;
  309.         return $this;
  310.     }
  311.     /**
  312.      * @return mixed
  313.      */
  314.     public function getSTATE()
  315.     {
  316.         return $this->STATE;
  317.     }
  318.     /**
  319.      * @param mixed $STATE
  320.      *
  321.      * @return StudentProfileModel
  322.      */
  323.     public function setSTATE($STATE)
  324.     {
  325.         $this->STATE $STATE;
  326.         return $this;
  327.     }
  328.     /**
  329.      * @return mixed
  330.      */
  331.     public function getORIGIN()
  332.     {
  333.         return $this->ORIGIN;
  334.     }
  335.     /**
  336.      * @param mixed $ORIGIN
  337.      *
  338.      * @return StudentProfileModel
  339.      */
  340.     public function setORIGIN($ORIGIN)
  341.     {
  342.         $this->ORIGIN $ORIGIN;
  343.         return $this;
  344.     }
  345.     /**
  346.      * @return mixed
  347.      */
  348.     public function getHPHONE()
  349.     {
  350.         return $this->HPHONE;
  351.     }
  352.     /**
  353.      * @param mixed $HPHONE
  354.      *
  355.      * @return StudentProfileModel
  356.      */
  357.     public function setHPHONE($HPHONE)
  358.     {
  359.         $this->HPHONE $HPHONE;
  360.         return $this;
  361.     }
  362.     /**
  363.      * @return mixed
  364.      */
  365.     public function getLASTSCH()
  366.     {
  367.         return $this->LASTSCH;
  368.     }
  369.     /**
  370.      * @param mixed $LASTSCH
  371.      *
  372.      * @return StudentProfileModel
  373.      */
  374.     public function setLASTSCH($LASTSCH)
  375.     {
  376.         $this->LASTSCH $LASTSCH;
  377.         return $this;
  378.     }
  379.     /**
  380.      * @return mixed
  381.      */
  382.     public function getLASTSCHCITY()
  383.     {
  384.         return $this->LASTSCH_CITY;
  385.     }
  386.     /**
  387.      * @param mixed $LASTSCH_CITY
  388.      *
  389.      * @return StudentProfileModel
  390.      */
  391.     public function setLASTSCHCITY($LASTSCH_CITY)
  392.     {
  393.         $this->LASTSCH_CITY $LASTSCH_CITY;
  394.         return $this;
  395.     }
  396.     /**
  397.      * @return mixed
  398.      */
  399.     public function getYRARRIVAL()
  400.     {
  401.         return $this->YR_ARRIVAL;
  402.     }
  403.     /**
  404.      * @param mixed $YR_ARRIVAL
  405.      *
  406.      * @return StudentProfileModel
  407.      */
  408.     public function setYRARRIVAL($YR_ARRIVAL)
  409.     {
  410.         $this->YR_ARRIVAL $YR_ARRIVAL;
  411.         return $this;
  412.     }
  413.     /**
  414.      * @return mixed
  415.      */
  416.     public function getAGENTNAME()
  417.     {
  418.         return $this->AGENT_NAME;
  419.     }
  420.     /**
  421.      * @param mixed $AGENT_NAME
  422.      *
  423.      * @return StudentProfileModel
  424.      */
  425.     public function setAGENTNAME($AGENT_NAME)
  426.     {
  427.         $this->AGENT_NAME $AGENT_NAME;
  428.         return $this;
  429.     }
  430.     /**
  431.      * @return mixed
  432.      */
  433.     public function getHOMEFAX()
  434.     {
  435.         return $this->HOME_FAX;
  436.     }
  437.     /**
  438.      * @param mixed $HOME_FAX
  439.      *
  440.      * @return StudentProfileModel
  441.      */
  442.     public function setHOMEFAX($HOME_FAX)
  443.     {
  444.         $this->HOME_FAX $HOME_FAX;
  445.         return $this;
  446.     }
  447.     /**
  448.      * @return mixed
  449.      */
  450.     public function getSTUMAIL()
  451.     {
  452.         return $this->STU_MAIL;
  453.     }
  454.     /**
  455.      * @param mixed $STU_MAIL
  456.      *
  457.      * @return StudentProfileModel
  458.      */
  459.     public function setSTUMAIL($STU_MAIL)
  460.     {
  461.         $this->STU_MAIL $STU_MAIL;
  462.         return $this;
  463.     }
  464.     /**
  465.      * @return mixed
  466.      */
  467.     public function getSTUMAILALT()
  468.     {
  469.         return $this->STU_MAIL_ALT;
  470.     }
  471.     /**
  472.      * @param mixed $STU_MAIL_ALT
  473.      *
  474.      * @return StudentProfileModel
  475.      */
  476.     public function setSTUMAILALT($STU_MAIL_ALT)
  477.     {
  478.         $this->STU_MAIL_ALT $STU_MAIL_ALT;
  479.         return $this;
  480.     }
  481.     /**
  482.      * @return mixed
  483.      */
  484.     public function getApplicantId()
  485.     {
  486.         return $this->applicant_id;
  487.     }
  488.     /**
  489.      * @param mixed $applicant_id
  490.      *
  491.      * @return StudentProfileModel
  492.      */
  493.     public function setApplicantId($applicant_id)
  494.     {
  495.         $this->applicant_id $applicant_id;
  496.         return $this;
  497.     }
  498.     /**
  499.      * @return mixed
  500.      */
  501.     public function getApplicantUuid()
  502.     {
  503.         return $this->applicant_uuid;
  504.     }
  505.     /**
  506.      * @param mixed $applicant_uuid
  507.      *
  508.      * @return StudentProfileModel
  509.      */
  510.     public function setApplicantUuid($applicant_uuid)
  511.     {
  512.         $this->applicant_uuid $applicant_uuid;
  513.         return $this;
  514.     }
  515.     function loadFromEntity(StudentProfile $student)
  516.     {
  517.         $this
  518.             ->setIDNUM($student->getStudentNumber())
  519.             ->setLASTN($student->getLastName())
  520.             ->setFIRSTN($student->getGivenName())
  521.             ->setMIDDLEN($student->getMiddleName())
  522. //            ->setDR()
  523.             ->setSEX($student->getGender())
  524.             ->setDBIRTH($student->getDateOfBirth()->format("Y-m-d"))
  525.             ->setCITIZ($student->getCitizenship())
  526. //            ->setLADD1()
  527. //            ->setLADD2()
  528. //            ->setLCITY()
  529. //            ->setLPRO()
  530.             ->setHADD1($student->getHomeAddress())
  531.             ->setHADD2($student->getHomeAddress2())
  532.             ->setHCITY($student->getHomeCity())
  533.             ->setSTATE($student->getHomeProvince())
  534.             ->setORIGIN($student->getHomeCountry())
  535.             ->setHPHONE($student->getPhone())
  536. //            ->setHOME_FAX($student->getF)
  537.             ->setSTUMAIL($student->getEmail())
  538.             ->setSTUMAILALT($student->getAlternateEmailAddress())
  539. //            ->setLASTSCH($student->getLa)
  540. //            ->setLASTSCH_CITY()
  541. //            ->setYR_ARRIVAL()
  542. //            ->setAGENT_NAME()
  543.             ->setApplicantId($student->getApplicantNumber())
  544.             ->setApplicantUuid($student->getApplicantUuid());
  545.     }
  546.     function loadFromArray($array)
  547.     {
  548.         if (array_key_exists('IDNUM'$array))
  549.             $this->setIDNUM($array['IDNUM']);
  550.         if (array_key_exists('LASTN'$array))
  551.             $this->setLASTN($array['LASTN']);
  552.         if (array_key_exists('FIRSTN'$array))
  553.             $this->setFIRSTN($array['FIRSTN']);
  554.         if (array_key_exists('MIDDLEN'$array))
  555.             $this->setMIDDLEN($array['MIDDLEN']);
  556.         if (array_key_exists('SEX'$array))
  557.             $this->setSEX($array['SEX']);
  558.         if (array_key_exists('CITIZ'$array))
  559.             $this->setCITIZ($array['CITIZ']);
  560.         if (array_key_exists('HADD1'$array))
  561.             $this->setHADD1($array['HADD1']);
  562.         if (array_key_exists('HADD2'$array))
  563.             $this->setHADD2($array['HADD2']);
  564.         if (array_key_exists('HCITY'$array))
  565.             $this->setHCITY($array['HCITY']);
  566.         if (array_key_exists('STATE'$array))
  567.             $this->setState($array['STATE']);
  568.         if (array_key_exists('ORIGIN'$array))
  569.             $this->setORIGIN($array['ORIGIN']);
  570.         if (array_key_exists('HPHONE'$array))
  571.             $this->setHPHONE($array['HPHONE']);
  572.         if (array_key_exists('STU_MAIL'$array))
  573.             $this->setSTUMAIL($array['STU_MAIL']);
  574.         if (array_key_exists('STU_MAIL_ALT'$array))
  575.             $this->setSTUMAILALT($array['STU_MAIL_ALT']);
  576.         if (array_key_exists('applicant_id'$array))
  577.             $this->setApplicantId($array['applicant_id']);
  578.         if (array_key_exists('applicant_uuid'$array))
  579.             $this->setApplicantUuid($array['applicant_uuid']);;
  580.     }
  581.     public function jsonSerialize() :mixed
  582.     {
  583.         return $this->serialize();
  584.     }
  585.     public function __serialize(): array
  586.     {
  587.         return $this->serialize();
  588.     }
  589.     public function serialize(): array
  590.     {
  591.         $data = [];
  592.         foreach (get_object_vars($this) as $key => $val) {
  593.             $data[$key] = $val;
  594.         }
  595.         return $data;
  596.     }
  597.     public function __unserialize($serialized)
  598.     {
  599.         return $this->unserialize($serialized);
  600.     }
  601.     public function unserialize($serialized)
  602.     {
  603.         // Using the KEYS to match the legacy DB columns meant that each field had to be
  604.         // set by hand due to the inconsistencies in naming
  605.         $this->loadFromArray($serialized);
  606. //        foreach ($serialized as $key => $val) {
  607. //            $prop = $this->snakeToCamel($key);
  608. //            $f = "set" . ucfirst($prop);
  609. //            if (method_exists($this, $f)) {
  610. //                $this->$f($val);
  611. //            }
  612. //        }
  613.     }
  614.     function camel_to_snake($input)
  615.     {
  616.         return strtolower(preg_replace('/(?<!^)[A-Z]/''_$0'$input));
  617.     }
  618.     function snakeToCamel($input)
  619.     {
  620.         return lcfirst(str_replace(' '''ucwords(str_replace('_'' '$input))));
  621. //        return lcfirst(str_replace('', '', ucwords($input, '')));
  622.     }
  623.    //convert ProperyName to LegacyDB field, to ease Readabiliy, and clean up code
  624.     // Not implmented
  625.     //
  626.     // TODO buildup legacyKey method to stream line code
  627.     function getLegacyKey(string $property) {
  628.         switch($property) {
  629.             default:
  630.                 return strtoupper($property); //Simply Upper
  631.                 break;
  632.             case 'uuid':
  633.                 return $property//Leave as Is
  634.                 break;
  635.             case 'EXAMPLE':
  636.                 return 'EXAMPLE';
  637.                 break;
  638.         }
  639.     }
  640. }
  641. //class Parent1
  642. //{
  643. //    private $FATHER;
  644. //    private $DAD_FAX;
  645. //    private $DAD_CELL;
  646. //    private $DAD_WORK;
  647. //    private $DAD_MAIL;
  648. //    private $DAD_MAIL_ALT;
  649. //    private $parent1_uuid;
  650. //
  651. //}
  652. //
  653. //class Parent2
  654. //{
  655. //  private $MOTHER;
  656. //  private $MOM_FAX;
  657. //    private $MOM_CELL;
  658. //    private $MOM_WORK;
  659. //    private $MOM_MAIL;
  660. //    private $MOM_MAIL_ALT;
  661. //    private $parent2_uuid;
  662. //
  663. //
  664. //}
  665. /*
  666.  *
  667.  */