Friday, January 11, 2013

Deleting associated records

Hello Everyone,

I need to delete associated records.

I have tried but can't figure it out.

Here is my situation,

Database,

questions {id(pk), question, answer}

options {id(pk), question_id, option_value}

Models,

Question

..

public $hasMany = array( 'Option' => array('dependant' => true));

..

Option

..

public $belongsTo = array( 'Question' );

..

Controllers,

QuestionController

..

public function delete($id = null){

$this->Question->delete($id,true)

}

..

Still its not working with deletion. Otherwise everything works fine about association.

Please Help Me.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate