FAQ
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 [email protected].
To unsubscribe from this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.

Search Discussions

  • Chetan Varshney at Jan 12, 2013 at 8:01 am
    Silly mistake-

    check spelling of dependent in has many.
    On Sat, Jan 12, 2013 at 9:58 AM, wrote:

    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 [email protected].
    To unsubscribe from this group, send email to
    [email protected].
    Visit this group at http://groups.google.com/group/cake-php?hl=en.



    --
    Chetan Varshney
    Ektanjali Softwares Pvt Ltd

    --
    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 [email protected].
    To unsubscribe from this group, send email to [email protected].
    Visit this group at http://groups.google.com/group/cake-php?hl=en.
  • Amit Sukapure89 at Jan 12, 2013 at 8:31 am
    Oh Yes !!
    Thanks a lot.

    --
    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 [email protected].
    To unsubscribe from this group, send email to [email protected].
    Visit this group at http://groups.google.com/group/cake-php?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcake-php @
categoriesphp
postedJan 12, '13 at 7:26a
activeJan 12, '13 at 8:31a
posts3
users2
websitecakephp.org
irc#cakephp

People

Translate

site design / logo © 2023 Grokbase