as i known
'dependent' - must be a boolean (not a string)
and you don't need to specify default parameter in model::delete function
<?php
class Inventory extends AppModel {
var $name = 'Inventory';
var $validate = array(
'title' => VALID_NOT_EMPTY,
'description' => VALID_NOT_EMPTY,
'cost' => VALID_NOT_EMPTY,
);
var $hasMany = array(
'Photo' =>
array('className' => 'Photo',
'foreignKey' => 'inventory_id',
'dependent' => true //
real boolean variable
),
);
}
?>
<?php
class InventoriesController extends AppController {
var $name = 'Inventories';
var $uses = array('Inventory', 'Photo');
var $helpers = array('Html', 'Form' );
function admin_delete($id = null) {
if(!$id) {
$this->Session->setFlash('Invalid id for Inventory');
$this->redirect('/admin/inventories/index');
}
if($this->Inventory->del($id)) { // you don't need to
specify default value
$this->Session->setFlash('The Inventory
deleted: id '.$id.'');
$this->redirect('/admin/inventories/index');
}
}
}
?>
2007/5/15, rockit <[EMAIL PROTECTED]>:
> do i have my dependent keys set properly in my models? and is the
> $cascade option properly being passed in my delete function?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---