function field_test_entity_test_load

Loads a test_entity.

Parameters

$ftid: The id of the entity to load.

$ftvid: (Optional) The revision id of the entity to load. If not specified, the current revision will be used.

Return value

The loaded entity.

11 calls to field_test_entity_test_load()
FieldFormTestCase::testFieldFormAccess in modules/field/tests/field.test
Tests fields with no 'edit' access.
FieldFormTestCase::testFieldFormSingle in modules/field/tests/field.test
FieldFormTestCase::testFieldFormSingleRequired in modules/field/tests/field.test
FieldFormTestCase::testFieldFormUnlimited in modules/field/tests/field.test
FieldSqlStorageTestCase::testFieldSqlStorageMultipleConditionsDifferentColumnsMultipleLanguages in modules/field/modules/field_sql_storage/field_sql_storage.test
Test handling multiple conditions on multiple columns of one field for multiple languages.

... See full list

File

modules/field/tests/field_test.entity.inc, line 244

Code

function field_test_entity_test_load($ftid, $ftvid = NULL) {
    // Load basic strucure.
    $query = db_select('test_entity', 'fte', array())->condition('fte.ftid', $ftid);
    if ($ftvid) {
        $query->join('test_entity_revision', 'fter', 'fte.ftid = fter.ftid');
        $query->addField('fte', 'ftid');
        $query->addField('fte', 'fttype');
        $query->addField('fter', 'ftvid');
        $query->condition('fter.ftvid', $ftvid);
    }
    else {
        $query->fields('fte');
    }
    $entities = $query->execute()
        ->fetchAllAssoc('ftid');
    // Attach fields.
    if ($ftvid) {
        field_attach_load_revision('test_entity', $entities);
    }
    else {
        field_attach_load('test_entity', $entities);
    }
    return $entities[$ftid];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.