ChadoPrefixExtender.inc 937 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * SelectQueryExtender to use chado_replace_table_prefix().
  4. *
  5. * Note that extenders can only be called on an existing db_select().
  6. * Therefore the table name in the initial select must be prefixed prior to
  7. * initialization. Read more about extenders:
  8. * https://www.drupal.org/docs/7/api/database-api/dynamic-queries/extenders.
  9. */
  10. class ChadoPrefixExtender extends SelectQueryExtender {
  11. /**
  12. * Overwrites the join to prefix table names.
  13. *
  14. * @param string $table
  15. * Table to join.
  16. * @param null $alias
  17. * Alias for joined table.
  18. * @param null $condition
  19. * Operation for joining.
  20. * @param array $arguments
  21. * Additional arguments.
  22. *
  23. * @return $this
  24. */
  25. public function join($table, $alias = NULL, $condition = NULL, $arguments = []) {
  26. $table = chado_replace_table_prefix($table);
  27. $this->query->join($table, $alias, $condition, $arguments);
  28. return $this;
  29. }
  30. }