tags:

views:

61

answers:

2

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?

+1  A: 

The $_primary_val names 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

Bill Karwin
+1  A: 

$_primary_val property was useful in v2.3.4 (ORM has a select_list() method). There is no such method in ORMv3 (yet).

biakaveron