Not a developer? Go to MovableType.com

Documentation

Determining if an object exists in the datastore

To check an object for existence in the datastore, use the exists method:

$obj->exists()

if ($foo->exists) {
    print "Foo $foo already exists!";
}

To test for the existence of an unloaded object, use the ‘exist’ method:

Class->exist( \%terms )

if (MT::Foo->exist( { foo => 'bar' })) {
    print "Already exists!";
}

This is typically faster than issuing a count call.

Back

Leave a Comment