メインコンテンツまでスキップ
Version: Fegg 5.x

Model::erase

主キーを指定して行を消去します(物理削除)

説明​

public int Model::erase( mixed $id )

主キーが$idの行をテーブルから消し(DELETE)、削除した行数を返します。論理削除にはdeleteを使います。

引数​

名前データ型デフォルト備考
$idmixed削除する行の主キーの値

例​

Controller
$model = new Model(true, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));

$erased = $model->erase(1);
// -> 1