メインコンテンツまでスキップ
Version: Fegg 5.x(開発版)

Model::setPrimary

Set Primary ID name

Description​

public self Model::setPrimary( string $id )

The primary key is used by id, updateRow, delete, erase and the other methods that take an ID. Throws InvalidArgumentException when $id is not a plain name.

Arguments​

NameData typeDefaultRemarks
$idstringPrimary key column name

Example​

Controller
$model = new Model();
$model->setPrimary('news_id');

// Same as the following
$model = new Model(false, array(
'id' => 'news_id',
));