src/xPDO/xPDO.php
public function getPKType($className, $pk= false) {
        $pktype= null;
        if ($actualClassName= $this->loadClass($className)) {
            if (!$pk)
                $pk= $this->getPK($actualClassName);
            if (!is_array($pk))
                $pk= array($pk);
            $ancestry= $this->getAncestry($actualClassName, true);
            foreach ($pk as $_pk) {
                foreach ($ancestry as $parentClass) {
                    if (isset ($this->map[$parentClass]['fieldMeta'][$_pk]['phptype'])) {
                        $pktype[$_pk]= $this->map[$parentClass]['fieldMeta'][$_pk]['phptype'];
                        break;
                    }
                }
            }
            if (is_array($pktype) && count($pktype) == 1) {
                $pktype= reset($pktype);
            }
            elseif (empty($pktype)) {
                $pktype= null;
            }
        } else {
            $this->log(xPDO::LOG_LEVEL_ERROR, "Could not load class {$className}!");
        }
        return $pktype;
    }
public function getPKType($className, $pk= false) {
        $pktype= null;
        if ($actualClassName= $this->loadClass($className)) {
            if (!$pk)
                $pk= $this->getPK($actualClassName);
            if (!is_array($pk))
                $pk= array($pk);
            $ancestry= $this->getAncestry($actualClassName, true);
            foreach ($pk as $_pk) {
                foreach ($ancestry as $parentClass) {
                    if (isset ($this->map[$parentClass]['fieldMeta'][$_pk]['phptype'])) {
                        $pktype[$_pk]= $this->map[$parentClass]['fieldMeta'][$_pk]['phptype'];
                        break;
                    }
                }
            }
            if (is_array($pktype) && count($pktype) == 1) {
                $pktype= reset($pktype);
            }
            elseif (empty($pktype)) {
                $pktype= null;
            }
        } else {
            $this->log(xPDO::LOG_LEVEL_ERROR, "Could not load class {$className}!");
        }
        return $pktype;
    }
public function getPKType ( $ className , $ pk = false ) { $ pktype = null ; if ( $ actualClassName = $ this -> loadClass ( $ className ) ) { if ( ! $ pk ) $ pk = $ this -> getPK ( $ actualClassName ) ; if ( ! is_array ( $ pk ) ) $ pk = array ( $ pk ) ; $ ancestry = $ this -> getAncestry ( $ actualClassName , true ) ; foreach ( $ pk as $ _pk ) { foreach ( $ ancestry as $ parentClass ) { if ( isset ( $ this -> map [ $ parentClass ] [ 'fieldMeta' ] [ $ _pk ] [ 'phptype' ] ) ) { $ pktype [ $ _pk ] = $ this -> map [ $ parentClass ] [ 'fieldMeta' ] [ $ _pk ] [ 'phptype' ] ; break ; } } } if ( is_array ( $ pktype ) && count ( $ pktype ) == 1 ) { $ pktype = reset ( $ pktype ) ; } elseif ( empty ( $ pktype ) ) { $ pktype = null ; } } else { $ this -> log ( xPDO :: LOG_LEVEL_ERROR , "Could not load class {$className}!" ) ; } return $ pktype ; }
Gets the type of primary key field for a class.

@param string $className The name of the class to lookup the primary key
type for.
@param mixed $pk Optional specific PK column or columns to get type(s) for.
@return string The type of the field representing a class instance primary
key, or null if no primary key is found or defined for the class.
Gets the type of primary key field for a class .