Re: Dependent models

2010-04-26 Thread etipaced
Pablo, The relationships you create in Cake are handled by setting any of the following model properties: - hasOne - hasMany - belongsTo - hasAndBelongsToMany You are probably familiar with this already if you're using Cake at all. The relationships don't require the database tables themselves

Re: Dependent models

2010-04-26 Thread Jeremy Burns
I would ALWAYS add database relationships because (i) it will perform a lot better (your database does not care or know that you are using Cake) and (ii) it is the ultimate safety net against bad deletes and orphan records. Jeremy Burns jeremybu...@me.com On 27 Apr 2010, at 00:03, etipaced

Re: Dependent models

2010-04-11 Thread Pablo Vergara B.
How do you actually can use database CASCADE deleting method when no real relations are made into the database diagram? (Because relations are handled internally by cakePHP) I'm still a novice about cakePHP so I can be wrong... or not. Let's wait for a advanced user to answer both questions :).

Re: Dependent models

2010-04-11 Thread Lucca Mordente
You really can't create this relation directly on the database. If you want your DB to be faster, you must do it by your own, creating foreing key indexes. On Sunday, April 11, 2010, Pablo Vergara B. pabloandre...@gmail.com wrote: How do you actually can use database CASCADE deleting method when

Re: Dependent models

2010-04-11 Thread Lucca Mordente
These internal database relations are not created by CakePHP, really. If you want your database to faster, you must do it by your own, creating foreign key indexes. On 11 abr, 08:40, Lucca Mordente luccamorde...@gmail.com wrote: You really can't create this relation directly on the database. If

Dependent models

2010-04-10 Thread Mateusz Kaczanowski
Hi guys, In CakePHP we delete related records by dependency in model. Which way us better 1. Set up CASCADE in innodb mysql database 2. Use dependent in cakePHP model Better - I mean faster , safer . Thanks for answers Check out the new CakePHP Questions site http://cakeqs.org and help others

Re: Dependent models

2010-04-10 Thread Lucca Mordente
The faster is using cascade, because it handled at a lower level than the application level. However, it's safer to delete related model through dependent, specially when this model implements a beforeDelete or afterDelete callbacks (do not forhet the attached behaviors). When it's not handled by

Deleting dependent models with conditions

2008-06-07 Thread floob
Has anyone ever deleted from a Model that has dependent joins with conditions, and realized that more rows got deleted than they expected? To give an example, let's declare 3 classes, Book Cd and OverallFavorite. OverallFavorite stores your prioritized rank of all of your favorite stuff ...

Re: Deleting dependent models with conditions

2008-06-07 Thread floob
Almost forgot ... here's the link to the ticket: https://trac.cakephp.org/ticket/4202 On Jun 7, 1:42 pm, floob [EMAIL PROTECTED] wrote: Has anyone ever deleted from a Model that has dependent joins with conditions, and realized that more rows got deleted than they expected? To give an