ChadoDataType.inc 868 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * The class used for Chado data type entities
  4. */
  5. class ChadoDataType extends Entity {
  6. public $type;
  7. public $label;
  8. public function __construct($values = array()) {
  9. parent::__construct($values, 'chado_data_type');
  10. }
  11. }
  12. /**
  13. * Gets an array of all chado data types, keyed by the type name.
  14. *
  15. * @param $type_name
  16. * If set, the type with the given name is returned.
  17. * @return ChadoDataType[]
  18. * Depending whether $type isset, an array of chado data types or a single one.
  19. */
  20. function chado_data_get_types($type_name = NULL) {
  21. // entity_load will get the Entity controller for our entity and call the load
  22. // function of that object - we are loading entities by name here.
  23. $types = entity_load_multiple_by_name('chado_data_type', isset($type_name) ? array($type_name) : FALSE);
  24. return isset($type_name) ? reset($types) : $types;
  25. }