Example #1
0
 /**
  * Returns a Field object. If the column is NOT in the table, a
  * Error is thrown by the Field constructor
  * @param string $column_name Name of the column in this table
  * @param string $alias       Query alias used when referencing this field
  * @return Field
  */
 public function getField($column_name, $alias = null)
 {
     if (!$this->db->allowed($column_name)) {
         throw new \Exception(t('Improper column name "%s"', $column_name));
     }
     $field = new Field($this, $column_name, $alias);
     if (!($field->allowSplat() && $column_name == '*') && (DATABASE_CHECK_COLUMNS && !$this->columnExists($column_name))) {
         throw new \Exception(t('Column does not exist in %s "%s"', get_class($this), $this->getFullName()));
     }
     return $field;
 }