Example #1
0
 public static function has_id($table_name)
 {
     $table = new Table();
     $table->name = $table_name;
     foreach ($table->get_columns() as $column) {
         if ($column->is_id()) {
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
Example #2
0
 /**
  * Get the value of this Record's title column.
  * @return string
  */
 public function get_title()
 {
     $title_col = $this->table->get_title_column();
     if ($title_col !== $this->table->get_pk_column()) {
         $title_col_name = $title_col->get_name();
         return $this->data->{$title_col_name};
     } else {
         $title_parts = array();
         foreach ($this->table->get_columns() as $col) {
             $col_name = $col->get_name() . self::FKTITLE;
             $title_parts[] = $this->{$col_name}();
         }
         return '[ ' . join(' | ', $title_parts) . ' ]';
     }
 }