final function KeyField()
    {
        if (!$this->keyField)
        {
            $fieldMappers = $this->FieldMappers();
            foreach ($fieldMappers as $name=>$mapper)
            {
                $keyInfo = $mapper->FieldInfo()->KeyInfo();
                if ($keyInfo && $keyInfo->IsPrimary())
                {
                    $this->keyField = $name;
                    break;
                }
            }
            if (!$this->keyField)
            {
                throw new \Exception('No (primary) key field found in ' . $this->TableName());
            }
        }
        return $this->keyField;
    }
final function KeyField()
    {
        if (!$this->keyField)
        {
            $fieldMappers = $this->FieldMappers();
            foreach ($fieldMappers as $name=>$mapper)
            {
                $keyInfo = $mapper->FieldInfo()->KeyInfo();
                if ($keyInfo && $keyInfo->IsPrimary())
                {
                    $this->keyField = $name;
                    break;
                }
            }
            if (!$this->keyField)
            {
                throw new \Exception('No (primary) key field found in ' . $this->TableName());
            }
        }
        return $this->keyField;
    }
final function KeyField ( ) { if ( ! $ this -> keyField ) { $ fieldMappers = $ this -> FieldMappers ( ) ; foreach ( $ fieldMappers as $ name => $ mapper ) { $ keyInfo = $ mapper -> FieldInfo ( ) -> KeyInfo ( ) ; if ( $ keyInfo && $ keyInfo -> IsPrimary ( ) ) { $ this -> keyField = $ name ; break ; } } if ( ! $ this -> keyField ) { throw new \ Exception ( 'No (primary) key field found in ' . $ this -> TableName ( ) ) ; } } return $ this -> keyField ; }
Gets the key field name.
@return string
@throws \Exception if no key field exists
Gets the key field name .