saveally dapatkan semua id simpan cakphp
public $saved_ids = array(
'insert' => array(
'count' => 0, 'id' => array()
),
'update' => array(
'count' => 0, 'id' => array()
)
);
function afterSave( $created, $options = array() ){
if( $created ){
$this->saved_ids['insert']['count']++;
$this->saved_ids['insert']['id'][] = $this->getID(); // get insert lasted id into database (vilh)
} else {
$this->saved_ids['update']['count']++;
$this->saved_ids['update']['id'][] = $this->getID();
}
return $this->saved_ids;
}
if ($this->MemberBookFacility->saveAll($data_MemberBookFacility)) {
pr ($this->MemberBookFacility->saved_ids['insert']['id']); // get multiple ids
}
Zidane (Vi Ly - VietNam)