Jump to main content Jump to doc navigation

xPDOObject::getPK()

Gets the name (or names) of the primary key field(s) for the object.

Syntax

API Docs: http://api.modxcms.com/xpdo/om/xPDOObject.html#getPK

mixed getPK ()

Example

Get the PK of a Person object, who's PK field is 'id'.

$person = $xpdo->getObject('Person',1);
$pk = $person->getPK();
echo $pk;
// prints "id"