From: | Sam Vilain <sam [...] vilain.net> |
To: | tangram-t2-maintainers [...] hottub.perlfect.com |
Subject: | Re: [tangram-t2-maintainers] a question about deleting things... |
Date: | Mon, 8 Sep 2003 13:03:28 +0100 |
CC: | bug-Tangram [...] rt.cpan.org |
On Mon, 08 Sep 2003 12:22, Giorgos Zervas wrote;
Show quoted text
> Agreed. But wouldn't it be possible and desirable to just set the
> appropriate columns (car, car_type) in the CarOwner table to NULL?
> That's what I do now manually.
Oh, silly me.
# create a person with a car and then store them
my $car = Car->new(...);
my $person = Person->new(car => $car);
$storage->insert($person);
# now delete the car!
$storage->erase($car);
# This is what you're missing.
$storage->update($person);
Show quoted text > Basically I get no error... Invoking $person->get_car returns a
> Car object whose attributes are all undefined. (remember that I am
> also using Class::Tangram). This to me is not expected
> behavior. What I would expect is $person->get_car to return undef.
ok, I'll make a bug report for this behaviour, there should either be
an error or behave as if the data was NULL in the first place.
Show quoted text > You guessed right... My problem here is that I am trying to map a
> 1-1 relationship between a person and car. A Person can have only
> one Car and a Car belong to just one Person at any time. Therefore
> using a set or an iset seems like overkill just to store only one
> object inside it.
Sure. So, you're using the CarOwner group of attributes as a slave
class in the multiple inheritance sense - not a superclass in the pure
OO sense.
--
Sam Vilain, sam@vilain.net
After all is said and done, a lot more has been said than done.