示例#1
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VApplicantPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setTotalApplicant($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setDepartmentId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[2]]);
     }
 }
示例#2
0
 public static function doValidate(VApplicant $obj, $cols = null)
 {
     $columns = array();
     if ($cols) {
         $dbMap = Propel::getDatabaseMap(VApplicantPeer::DATABASE_NAME);
         $tableMap = $dbMap->getTable(VApplicantPeer::TABLE_NAME);
         if (!is_array($cols)) {
             $cols = array($cols);
         }
         foreach ($cols as $colName) {
             if ($tableMap->containsColumn($colName)) {
                 $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                 $columns[$colName] = $obj->{$get}();
             }
         }
     } else {
     }
     $res = BasePeer::doValidate(VApplicantPeer::DATABASE_NAME, VApplicantPeer::TABLE_NAME, $columns);
     if ($res !== true) {
         $request = sfContext::getInstance()->getRequest();
         foreach ($res as $failed) {
             $col = VApplicantPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
             $request->setError($col, $failed->getMessage());
         }
     }
     return $res;
 }