Finding out if a Doctrine 1 record is new or persisted

If you need to find out if a Doctrine record has been taken from the database or is newly created and not yet saved in the database, you can inspect the record's state property.

function isRecordNew(Doctrine_Record $record)
{
    $state = $record->state();
    return
        $state == Doctrine_Record::STATE_TCLEAN ||
        $state == Doctrine_Record::STATE_TDIRTY ||
        $state == Doctrine_Record::STATE_TLOCKED;
}

You can find out more about Doctrine record states in the "Getting Record State" manual page.