1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- class TripalEntity extends Entity {
- public function __construct($values = array(), $entity_type) {
- parent::__construct($values, $entity_type);
-
-
-
- if (property_exists($this, 'id') and $this->id) {
- $details = db_select('chado_entity', 'ce')
- ->fields('ce')
- ->condition('entity_id', $this->id)
- ->execute()
- ->fetchObject();
-
-
- $this->chado_entity_id = $details->chado_entity_id;
- $this->chado_table = $details->data_table;
- $this->chado_field = $details->field;
-
- $schema = chado_get_schema($this->chado_table);
- $pkey = $schema['primary key'][0];
- $this->chado_record_id = $details->record_id;
- $this->chado_record = chado_generate_var($this->chado_table, array($pkey =>+ $details->record_id));
- }
-
-
- else {
-
-
- $sel_values = array(
- 'term_id' => array(
- 'cvterm_id' => $this->cvterm_id,
- ),
- );
- $term_usage = chado_generate_var('tripal_term_usage', $sel_values, array('return_array' => 1));
-
- foreach ($term_usage as $usage) {
- $this->chado_table = $usage->data_table;
- $this->chado_field = $usage->field;
- }
- }
- }
- protected function defaultLabel() {
- return $this->title;
- }
- protected function defaultUri() {
- return array('path' => 'BioData/' . $this->id);
- }
- }
|