/** * Get the value of this record's primary key, or false if it doesn't have * one. * * @return string|false */ public function get_primary_key() { if ($this->table->get_pk_column()) { $pk_col_name = $this->table->get_pk_column()->get_name(); if (isset($this->data->{$pk_col_name})) { return $this->data->{$pk_col_name}; } } return false; }
/** * 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) . ' ]'; } }