Becky
Becky

Reputation: 348

Kohana ORM "primary value"

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?

Upvotes: 1

Views: 1340

Answers (2)

biakaveron
biakaveron

Reputation: 5483

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

Upvotes: 1

Bill Karwin
Bill Karwin

Reputation: 562368

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

Upvotes: 1

Related Questions