Should deep delete affect siblings?

4 views
Skip to first unread message

Garett

unread,
Feb 14, 2007, 7:44:18 PM2/14/07
to Php Object Generator
I have a situation that I don't think is being handled properly...

Take this scenario:

I have a couple tables that are linked together as siblings in a many
to many relationship -- we'll say pet and breed.

Now, when I want to delete a pet deeply -- it makes sense in my
application to leave breed untouched, though it currently goes right
ahead and deletes it. Another pet may be linked to the breed just
deleted.

Does it make sense to leave the deepest part of a many to many
relationship untouched in all circumstances?

Joel

unread,
Feb 15, 2007, 1:50:09 PM2/15/07
to Php Object Generator
Hi,

I see what you mean, and I think I agree. Another question is, if you
delete pet deeply and the breed(s) associated with that pet do(es) not
have other siblings at the time of the delete, should it/they then be
deleted? i'm not sure what the intuitive behavior is in that case. we
can

1) never delete anything more than the mapping when it comes to
siblings, or
2) delete the mappings AND the corresponding sibling objects if they
are not connected.

I think 1 is acceptable and would keep things consistent and simple...
and we would leave the cleaning of 'orphaned' siblings to the user /
get a plugin to do that.

Joel

Garett

unread,
Feb 15, 2007, 2:37:44 PM2/15/07
to Php Object Generator
I think that would be logical.

Thanks :)
Garett

Joel

unread,
Mar 30, 2007, 6:04:33 PM3/30/07
to Php Object Generator
I've revisited this issue recently and I think the best solution is,
in the case of siblings, to have a 2 flags when deleting: $deep and
$across.

1.when $deep is set to true, it would delete all children recursively,
but not the other siblings
2.when $across is set to true, it would delete all siblings
recursively
3.internal mappings are deleted no matter what
4.Setting both to true would have the equivalent effect of the current
deep = true.
5.Setting both to false would have the equivalent of the current deep
= false.

Comments?

Regards,
Joel

On Feb 15, 1:37 pm, "Garett" <goot...@gmail.com> wrote:
> I think that would be logical.
>
> Thanks :)
> Garett
>
> On Feb 15, 12:50 pm, "Joel" <joel...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I see what you mean, and I think I agree. Another question is, if you

> >deletepet deeply and the breed(s) associated with that pet do(es) not
> > have other siblings at the time of thedelete, should it/they then be


> > deleted? i'm not sure what the intuitive behavior is in that case. we
> > can
>

> > 1) neverdeleteanything more than the mapping when it comes to
> > siblings, or
> > 2)deletethe mappings AND the correspondingsiblingobjects if they


> > are not connected.
>
> > I think 1 is acceptable and would keep things consistent and simple...
> > and we would leave the cleaning of 'orphaned' siblings to the user /
> > get a plugin to do that.
>
> > Joel
>
> > On Feb 14, 5:44 pm, "Garett" <goot...@gmail.com> wrote:
>
> > > I have a situation that I don't think is being handled properly...
>
> > > Take this scenario:
>
> > > I have a couple tables that are linked together as siblings in a many
> > > to many relationship -- we'll say pet and breed.
>

> > > Now, when I want todeletea pet deeply -- it makes sense in my


> > > application to leave breed untouched, though it currently goes right
> > > ahead and deletes it. Another pet may be linked to the breed just
> > > deleted.
>
> > > Does it make sense to leave the deepest part of a many to many

> > > relationship untouched in all circumstances?- Hide quoted text -
>
> - Show quoted text -

Reply all
Reply to author
Forward
0 new messages