コード例 #1
0
ファイル: ResultSet.php プロジェクト: sad-spirit/pg-wrapper
 /**
  * Explicitly sets the type converter for the result field
  *
  * @param int|string $fieldIndex Either field number or field name
  * @param mixed      $type       Either an instance of Type or an
  *                               argument to TypeFactory::getConverter()
  * @return $this
  * @throws exceptions\InvalidArgumentException
  */
 public function setType($fieldIndex, $type)
 {
     $this->_checkFieldIndex($fieldIndex);
     if (is_string($fieldIndex)) {
         $fieldIndex = $this->_namesHash[$fieldIndex];
     }
     if (!$type instanceof TypeConverter) {
         $type = $this->_converterFactory->getConverter($type);
     }
     $this->_converters[$fieldIndex] = $type;
     return $this;
 }