when delating do you set the 'cascade' param ?

On Dec 16, 6:37 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Here is my model
> class Question extends AppModel {
>
>         var $name = 'Question';
>         var $validate = array(
>                 'question' => VALID_NOT_EMPTY,
>                 'type_id' => VALID_NOT_EMPTY,
>         );
>
>         //The Associations below have been created with all possible keys,
> those that are not needed can be removed
>         var $belongsTo = array(
>                         'Type' =>
>                                 array('className' => 'Type',
>                                                 'foreignKey' => 'type_id',
>                                                 'conditions' => '',
>                                                 'fields' => '',
>                                                 'order' => '',
>                                                 'counterCache' => ''
>                                 ),
>
>         );
>
>         var $hasMany = array(
>                         'Answer' =>
>                                 array('className' => 'Answer',
>                                                 'foreignKey' => 'question_id',
>                                                 'conditions' => '',
>                                                 'fields' => '',
>                                                 'order' => '',
>                                                 'limit' => '',
>                                                 'offset' => '',
>                                                 'dependent' => true,
>                                                 'exclusive' => '',
>                                                 'finderQuery' => '',
>                                                 'counterQuery' => ''
>                                 ),
>
> And here is the sql from questions and answers
> CREATE TABLE `p6_questions` (
>   `id` int(11) NOT NULL auto_increment,
>   `question` text NOT NULL,
>   `tip` text,
>   `type_id` int(11) NOT NULL,
>   `published` int(11) default NULL,
>   `created` datetime NOT NULL,
>   `modified` datetime NOT NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> CREATE TABLE `p6_answers` (
>   `id` int(11) NOT NULL auto_increment,
>   `answer` text NOT NULL,
>   `rational` text NOT NULL,
>   `priority` int(11) default NULL,
>   `correct` int(11) default NULL,
>   `question_id` int(11) NOT NULL,
>   `created` datetime NOT NULL,
>   `modified` datetime NOT NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;
>
> I have p6_ set as the prefix in the config file. I have no other
> problems except that when I delelte a question the related answers are
> not also deleted. Anyone have any ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to