FAQ
Hi,
I have tried but still not working.
My situation,
Question hasMany Option

Tables,
questions {id,question,answer}
options{id,option,question_id}

In QuestionsController , in delete menthod,
$this->Question->delete($id,true);

Everything works fine about association but not deletion.
Help me out.
Thanks



--
View this message in context: http://cakephp.1045679.n5.nabble.com/Delete-related-data-tp1318091p5713148.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
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.

Search Discussions

  • Lowpass at Jan 12, 2013 at 1:26 am
    Question model:

    public $hasMany = array(
    'Option' => array(
    ...
    'dependent' => true
    )
    );
    On Fri, Jan 11, 2013 at 4:03 AM, amitsukapure wrote:
    Hi,
    I have tried but still not working.
    My situation,
    Question hasMany Option

    Tables,
    questions {id,question,answer}
    options{id,option,question_id}

    In QuestionsController , in delete menthod,
    $this->Question->delete($id,true);

    Everything works fine about association but not deletion.
    Help me out.
    Thanks



    --
    View this message in context: http://cakephp.1045679.n5.nabble.com/Delete-related-data-tp1318091p5713148.html
    Sent from the CakePHP mailing list archive at Nabble.com.

    --
    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.
    --
    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.
  • Amit Sukapure89 at Jan 12, 2013 at 6:27 am
    Thanks for reply but still won't work.

    Question model:
    public $hasMany = array(
    'Option' => array(
    ...
    'dependent' => true
    )
    );
    --
    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.
  • Amitsukapure at Jan 12, 2013 at 9:22 pm
    Thanks for reply.
    I have made changes as you said but still it won't work.
    Is it with mysql database tables? Table type is Innodb.



    --
    View this message in context: http://cakephp.1045679.n5.nabble.com/Delete-related-data-tp1318091p5713175.html
    Sent from the CakePHP mailing list archive at Nabble.com.

    --
    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.
  • Lowpass at Jan 13, 2013 at 1:25 am

    On Fri, Jan 11, 2013 at 10:57 PM, amitsukapure wrote:
    Thanks for reply.
    I have made changes as you said but still it won't work.
    Is it with mysql database tables? Table type is Innodb.
    In that case, you can use FK constraints ...

    CREATE TABLE options (
    ...
    FOREIGN KEY (question_id) REFERENCES questions (id) ON DELETE CASCADE
    ) ENGINE=InnoDB ...

    --
    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.
  • Amitsukapure at Jan 14, 2013 at 3:46 am
    Thanks for helping solved issue. I was made silly mistake.
    Spelling mistake, dependant instead dependent.




    --
    View this message in context: http://cakephp.1045679.n5.nabble.com/Delete-related-data-tp1318091p5713212.html
    Sent from the CakePHP mailing list archive at Nabble.com.

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcake-php @
categoriesphp
postedJan 11, '13 at 11:02p
activeJan 14, '13 at 3:46a
posts6
users2
websitecakephp.org
irc#cakephp

2 users in discussion

Amitsukapure: 4 posts Lowpass: 2 posts

People

Translate

site design / logo © 2022 Grokbase