private function php2db($phpVal) { $type = PsCheck::phpType(gettype($phpVal), array($this->phpType, PsConst::PHP_TYPE_NULL)); switch ($type) { case PsConst::PHP_TYPE_NULL: return null; case PsConst::PHP_TYPE_INTEGER: return $phpVal; case PsConst::PHP_TYPE_STRING: return trim($phpVal); case PsConst::PHP_TYPE_BOOLEAN: return $phpVal ? 1 : 0; } raise_error('Нет правил конвертации ' . __FUNCTION__ . ' для типа ' . $type); }