Hairy problem with has_a and has_many

[prev] [thread] [next] [Date index for 2005/02/22]

From: JJ Merelo
Subject: Hairy problem with has_a and has_many
Date: 16:00 on 22 Feb 2005
Hi,
I'm using perl 5.8.3 on a Fedora Core 2, with CDBI, DBI and DBD::Pg in
their latest versions, ad I'm having a problem with code as simple as
this:
---->8--------------
create table rol(
	rol_tipo 	varchar(20) references rol_tipo (descripcion),	
    	persona_id	integer references persona on delete cascade,
	simposio_codigo varchar(5) references simposio on delete cascade,
	unique( persona_id, simposio_codigo, rol_tipo )
);
---------------------
Here's the module:
---->8--------------
package My::CEDI::Rol;

__PACKAGE__->table('rol');
__PACKAGE__->columns( Essential => qw( rol_tipo persona_id simposio_codigo) );

__PACKAGE__->has_a( persona_id => 'My::CEDI::Persona' );
__PACKAGE__->has_a( simposio_codigo => 'My::CEDI::Simposio' );
--------------------
The error is as follows: when an object of this type is created this way:
 my $rol = My::CEDI::Rol->find_or_create( { persona_id => $persona,
					     simposio_codigo => $simposio,
					     rol_tipo => $whatever } );
it enters this code in Class::DBI
--
sub _create {
	my ($proto, $data) = @_;
	my $class = ref $proto || $proto;

	my $self = $class->_init($data);
	$self->call_trigger('before_create'); <==================
	$self->call_trigger('deflate_for_create');

and then it calls triggers on the class My::CEDI::Persona, whose
object has been already created.

Any idea of why it happens? 

JJ

(message missing)

Hairy problem with has_a and has_many
JJ Merelo 16:00 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
Cees Hek 16:22 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
Joss Shaw 16:24 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
JJ Merelo 16:50 on 22 Feb 2005

And now with ContextualFetch
JJ Merelo 16:55 on 22 Feb 2005

Re: And now with ContextualFetch
Perrin Harkins 18:15 on 22 Feb 2005

Re: And now with ContextualFetch
JJ Merelo 18:25 on 22 Feb 2005

Re: Hairy problem with has_a and has_many
Perrin Harkins 18:17 on 22 Feb 2005

Re: And now with ContextualFetch
Perrin Harkins 18:41 on 22 Feb 2005

Re: And now with ContextualFetch
JJ Merelo 18:56 on 22 Feb 2005

RE: Hairy problem with has_a and has_many
Zhuang Li 20:03 on 23 Feb 2005

RE: Hairy problem with has_a and has_many
Zhuang Li 20:12 on 23 Feb 2005

Generated at 22:43 on 24 Feb 2005 by mariachi v0.52