|
Tripal
|
Public Member Functions | |
| getRenderableItem ($displayed_string, $entity_id) | |
| getEntityId ($record_id, $termIdSpace, $termAccession, $base_table=NULL, $entity_type='tripal_entity') | |
| getBundleLabel (int $entity_id, string $entity_type='tripal_entity') | |
| getPublishedEntityIds ($bundle_id, $entity_type='tripal_entity') | |
Protected Member Functions | |
| getBundleFromCvTerm ($termIdSpace, $termAccession) | |
| getBundles (string $base_table) | |
| getEntityIdFromRecordId ($record_id, $bundle_id, $entity_type) | |
| getRequiredFields ($bundle_id, $entity_type) | |
Protected Attributes | |
| array | $bundle_base_table_cache = [] |
| array | $bundle_label_cache = [] |
This class provides functions to assist with finding a Drupal entity that corresponds to a Chado record.
The two public functions defined here are: getEntityId() which looks up a Drupal entity id from a Chado record id getRenderableItem() is a helper function for field formatters, it will handle converting an entity_id into a render array element.
|
protected |
Retrieve a Tripal bundle id based on its CV term.
| string | $termIdSpace | The bundle's CV Term namespace e.g. "NCIT" |
| string | $termAccession | The bundle's CV term accession e.g. "C47954" |
| Drupal\tripal\Services\TripalEntityLookup::getBundleLabel | ( | int | $entity_id, |
| string | $entity_type = 'tripal_entity' |
||
| ) |
Retrieve the human-readable type (i.e. TripalEntityType label) for a given TripalEntity object.
| int | $entity_id | The TripalEntity ID value. This might be -1 for an unpublished entity. |
| string | $entity_type | The type of entity, only 'tripal_entity' is supported. |
|
protected |
Retrieve a list of Tripal bundles for a given base table.
| string | $base_table | The table name e.g. "contact" |
| Drupal\tripal\Services\TripalEntityLookup::getEntityId | ( | $record_id, | |
| $termIdSpace, | |||
| $termAccession, | |||
$base_table = NULL, |
|||
$entity_type = 'tripal_entity' |
|||
| ) |
Retrieve a Drupal entity ID for a record in a given bundle given the bundle's CV term.
| int | $record_id | The primary key value for the requested record |
| string | $termIdSpace | The bundle's CV Term namespace e.g. for gene "SO" |
| string | $termAccession | The bundle's CV term accession e.g. for gene "0000704" If IdSpace and Accession are NULL, then any bundle using the base table is checked. |
| string | $base_table | The Chado base table for the requested entity e.g. for gene "feature". Only needed if term does not map to a content type. |
| string | $entity_type | The type of entity, only 'tripal_entity' is supported. |
|
protected |
Retrieve the pkey for an entity corresponding to a given record in a given table.
| int | $record_id | The primary key value for the requested record in its base table. |
| string | $bundle_id | The name of the drupal bundle, e.g. for base table 'arraydesign' it is 'array_design' |
| string | $entity_type | The type of entity, only 'tripal_entity' is supported. |
| Drupal\tripal\Services\TripalEntityLookup::getPublishedEntityIds | ( | $bundle_id, | |
$entity_type = 'tripal_entity' |
|||
| ) |
Find all published entities within a given bundle. Unfortunately the drupal entity API 'loadMultiple' function is too slow, taking a second or two per entity. We instead query the Drupal field tables directly, because we just want a simple list of two of the columns.
| string | $bundle_id | The name of the drupal bundle, e.g. for base table 'arraydesign' it is 'array_design' |
| string | $entity_type | The type of entity, only 'tripal_entity' is supported. |
| Drupal\tripal\Services\TripalEntityLookup::getRenderableItem | ( | $displayed_string, | |
| $entity_id | |||
| ) |
This is used by field formatters to get a ready-to-use render array item to link to an entity.
| string | $displayed_string | The text that will be displayed as a url link. |
| int | $entity_id | The primary key value for the Drupal entity. We store -1 in the Drupal field tables to indicate when there is no Drupal entity because the TripalEntity class won't save a zero when drupal_store is TRUE. |
|
protected |
Retrieve a list of required fields in a given bundle
| string | $bundle_id | The name of the drupal bundle, e.g. 'analysis' |
| string | $entity_type | The type of entity, only 'tripal_entity' is supported. |
|
protected |
Caches bundle IDs used for a base table
|
protected |
Caches bundle information keyed by bundle machine ID