Objects tree with Class::DBI
[prev]
[thread]
[next]
[Date index for 2005/05/13]
Sorry for my previous post.
I have object definition:
package PXF::M::Section;
use strict;
use lib qw[./../../];
use base 'PXF::M::DBI';
__PACKAGE__->table('pxf_section');
__PACKAGE__->columns(Primary => qw[id]);
__PACKAGE__->columns(Essential => qw[path parent name]);
__PACKAGE__->has_a(parent => 'PXF::M::Section');
__PACKAGE__->has_many(children => ['PXF::M::Section' => 'parent']);
1;
and data in tables
id parent path name
5 0 test Section
6 5 test2 Section 2
After call
my @sections = PXF::M::Section->retrieve_all();
I expect something like that
[{
id => 5,
parent => undef,
path => 'test',
name => 'Section',
children => [{
id => 6,
parent => {
id => 5,
parent => undef,
path => 'test',
name => 'Section'
},
path => 'test',
name => 'Section'
}]
},
{
id => 6,
parent => {
id => 5,
parent => undef,
path => 'test',
name => 'Section'
},
path => 'test',
name => 'Section'
children => []
}
]
but I retrieve following list (printed with Data::Dump)
do {
my $a = bless({
id => 5,
name => "Section",
parent => bless({ id => 0 }, "PXF::M::Section"),
path => "test",
}, "PXF::M::Section");
(
$a,
bless({ id => 6, name => "Section 2", parent => $a, path => "test2" }, "PXF::M::Section"),
);
}
where is the children?
thanks for advise.
|
(message missing)
|
|
|
Objects tree with Class::DBI
subscribes 03:38 on 13 May 2005
|