Ejemplo n.º 1
0
 /**
  *   Add EducationData
  *   @param      EducationData   $data
  *   @return     Boolean
  *   @throws     Exception
  */
 public function addData($data)
 {
     //Check data
     $data->checkData(true);
     //Insert database
     return true;
 }
 /**
  * @dataProvider additionInitProvider
  */
 public function testInitDataObject($uid, $eduid, $schoolName, $majorName, $majorCat, $area, $schoolCountry, $startDate, $endDate, $degreeStatus)
 {
     $obj = EducationData::makeEducation($uid, $eduid, $schoolName, $majorName, $majorCat, $area, $schoolCountry, $startDate, $endDate, $degreeStatus);
     if ($eduid === null) {
         $this->setExpectedException('\\InvalidArgumentException', "eduid must only contain numeric.");
         $obj->checkData();
     }
 }
Ejemplo n.º 3
0
 /**
  *  Generator a education data object
  *
  *  @param      int         $uid            User id
  *  @param      int         $eduid          EduId, it can be null
  *  @param      string      $schoolName     School name
  *  @param      string      $majorName      majorName
  *  @param      string      $majorCat       majorCat
  *  @param      string      $area           area
  *  @param      string      $schoolCountry  schoolCountry
  *  @param      date        $startDate      startDate
  *  @param      date        $endDate        endDate
  *  @param      int         $degreeStatus   degreeStatus
  *  @throws     \InvalidArgumentException
  *
  */
 public static function makeEducation($uid, $eduid, $schoolName, $majorName, $majorCat, $area, $schoolCountry, $startDate, $endDate, $degreeStatus)
 {
     $dataObject = new EducationData();
     $dataObject->setUid($uid);
     $dataObject->setEduId($eduid);
     $dataObject->setSchoolName($schoolName);
     $dataObject->setMajorName($majorName);
     $dataObject->setMajorCat($majorCat);
     $dataObject->setArea($area);
     $dataObject->setSchoolCountry($schoolCountry);
     $dataObject->setStartDate($startDate);
     $dataObject->setEndDate($endDate);
     $dataObject->setDegreeStatus($degreeStatus);
     if ($dataObject->getEduId() === null) {
         $dataObject->checkData(true);
     } else {
         $dataObject->checkData(false);
     }
     return $dataObject;
 }
Ejemplo n.º 4
0
 public function doPost()
 {
     $data = EducationData::makeEducation($this->request->getAttribute('uid'), null, $this->request->getParams()['schoolName'], $this->request->getParams()['majorName'], $this->request->getParams()['majorCat'], $this->request->getParams()['area'], $this->request->getParams()['schoolCountry'], $this->request->getParams()['startDate'], $this->request->getParams()['startDate'], $this->request->getParams()['degreeStatus']);
     return $this->doSend(['result' => $this->model->addData($data)]);
 }
Ejemplo n.º 5
0
 private function getData()
 {
     $eduData = EducationData::makeEducation(12, 34, '1社會大學', '1資訊管理', '1商管學科類', '1亞洲', '1台灣', '2013-09', '2015-06', 1);
     return $eduData;
 }