예제 #1
0
 /**
  * @depends testPassword
  * @param \Application\EmpItem $emp
  */
 public function testArrayFunctions(\Application\EmpItem $emp)
 {
     $arr = $emp->toArray();
     $subset = array_merge(array(), self::$arrayToTest);
     unset($subset['pwd_hash']);
     $this->assertArraySubset($subset, $arr);
 }
예제 #2
0
 public function save(\Application\EmpItem $emp, \Core\Database $db)
 {
     $fields_to_save = $emp->toArray();
     unset($fields_to_save['id']);
     if (is_null($emp->getId()) || $emp->getId() == '') {
         $this->makeInsertQuery('employees', $fields_to_save, $db);
         $lid = $db->getLastInsertId();
         $emp->fromArray(array($emp->getIdFieldName() => $lid));
     } else {
         $this->makeUpdateQuery('employees', $fields_to_save, array('id' => $emp->getId()), $db);
     }
 }
예제 #3
0
 private function validatePassword(\Application\EmpItem $empItem, $value)
 {
     return $empItem->isPasswordEqual($value) ? '' : 'invalid current password';
 }