Re: Delete related data

2013-01-13 Thread amitsukapure
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Delete related data

2013-01-12 Thread amitsukapure
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Delete related data

2013-01-12 Thread lowpass
On Fri, Jan 11, 2013 at 10:57 PM, amitsukapure
amit.sukapur...@gmail.com 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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Delete related data

2013-01-11 Thread amitsukapure
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Delete related data

2013-01-11 Thread lowpass
Question model:

public $hasMany = array(
'Option' = array(
...
'dependent' = true
)
);

On Fri, Jan 11, 2013 at 4:03 AM, amitsukapure amit.sukapur...@gmail.com 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+unsubscr...@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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Delete related data

2013-01-11 Thread amit . sukapure89
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+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Delete related data

2009-03-12 Thread Dave Maharaj :: WidePixels.com
Can someone point me in the direction of how to delete records of related
models.
 
For example my USER hasOne - PROFILE
USER hasMany -COMMENTS
 
What I want to do is if I delete the USER it also deletes the PROFILE and
all the COMMENTS
 
Dave

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Delete related data

2009-03-12 Thread Miles J

$this-User-delete($id, true);

http://book.cakephp.org/view/516/Deleting-Data
Manual is your friend, simply set cascade to true.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Delete related data

2009-03-12 Thread Dave Maharaj :: WidePixels.com

Thanks man...

I did find it right after I posted the message. Cascade !

Thanks again. 

-Original Message-
From: Miles J [mailto:mileswjohn...@gmail.com] 
Sent: March-12-09 7:11 PM
To: CakePHP
Subject: Re: Delete related data


$this-User-delete($id, true);

http://book.cakephp.org/view/516/Deleting-Data
Manual is your friend, simply set cascade to true.


--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---