Basic Components - Record - Getting record state.php 963 Bytes
Newer Older
doctrine's avatar
doctrine committed
1 2 3 4 5
<?php
$state = $record->getState();

switch($state):
    case Doctrine_Record::STATE_PROXY:
6
        // record is in proxy state, 
doctrine's avatar
doctrine committed
7 8 9 10
        // meaning its persistent but not all of its properties are
        // loaded from the database
    break;
    case Doctrine_Record::STATE_TCLEAN:
11
        // record is transient clean,
doctrine's avatar
doctrine committed
12 13 14 15
        // meaning its transient and 
        // none of its properties are changed
    break;
    case Doctrine_Record::STATE_TDIRTY:
16
        // record is transient dirty,
doctrine's avatar
doctrine committed
17 18 19 20
        // meaning its transient and 
        // some of its properties are changed
    break;
    case Doctrine_Record::STATE_DIRTY:
21
        // record is dirty, 
doctrine's avatar
doctrine committed
22 23 24 25
        // meaning its persistent and 
        // some of its properties are changed
    break;
    case Doctrine_Record::STATE_CLEAN:
26
        // record is clean,
doctrine's avatar
doctrine committed
27 28 29 30 31
        // meaning its persistent and 
        // none of its properties are changed
    break;
endswitch;
?>