Jump to main content Jump to doc navigation

xPDOObject::isNew()

Indicates if the instance is new, and has not yet been persisted.

Syntax

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

boolean isNew ()

Examples

State if the Broom has been saved.

$broom = $xpdo->newObject('Broom');
$broom->set('name','Firebolt');

echo $broom->isNew() ? 1 : 0; // prints 1

$broom->save();

echo $broom->isNew() ? 1 : 0; // prints 0