I’ve been reading through the documentation for Kohana ORM and in their example model class it has a block of code like:
protected $_table_name = 'strange_tablename'; // default: accounts
protected $_primary_key = 'strange_pkey'; // default: id
protected $_primary_val = 'strange_name'; // default: name (column used as primary value)
Obviously I know what table name and primary key are but I’ve never seen the term “primary value” used before, what exactly is it used for?
The
$_primary_valnames another column in the table that you can optionally use as a more user-friendly identifier. So if it’s confusing for your users to see integer values like 69113 as the real primary key, you can present a different value like “The Poseidon Adventure”.http://docs.kohanaphp.com/libraries/orm#primary_val