取得方法
$this->getLastInsertID();
もしくは、
$this->getInsertID();
でinsertされたレコードのプライマリキー(デフォではid、プライマリキーを変更していれば変更後のカラム)を取得できる。
取得例
$this->save($data);
$lastInsertID = $this->getLastInsertID();
ちなみに、getLastInsertID()はgetInsertID()をラップしているだけ。たぶんどっちを使ってもいいけど、名前が直感的だからgetLastInsertID()をよく使う。
以下は、lib/Cake/Model/Model.phpのgetLastInsertIDメソッド。
public function getLastInsertID() {
return $this->getInsertID();
}