i wrote the following functions , which are pretty much nice and fine :
object_tree_to_json
object_tree_to_yaml
object_tree_to_hash
i'm now working on
object_tree_from_json
object_tree_from_yaml
object_tree_from_hash
and running into a few issues on those
I'm gonna lump all my questions right here:
a) when dealing with the relations , i need to store the object as
a
hash or array depending on the type of relation.
to catch this , i do
foreach my $rel ($self->meta->relationships)
{
my $mapping_type= ref( $rel );
arrays are:
Rose::DB::Object::Metadata::Relationship::ManyToMany
Rose::DB::Object::Metadata::Relationship::OneToMany
hashes are
Rose::DB::Object::Metadata::Relationship::ManyToOne
Rose::DB::Object::Metadata::Relationship::OneToOne
is there a better way of capturing the mapping type than doing
a
ref on the relationship ?
i saw how rose stored the relation , it was pretty abstract --
not
how i expected -- and there's no documentation on this sort of thing,
so I wanted to check that i'm accessing stuff in a safe manner that
is unlikely to change
b) see above:
i've noticed that the ManyToOne and OneToOne return arrays with
1
element in them -- not a hash. is this expected ?
i question this, because of c) below
c) when pulling a fkey relation , the object return is always a
hash.
foreach my $rel ($self->meta->foreign_keys)
{
if ( my $obj=
$rel->object_has_foreign_object($self) )
d) when restoring an object, i'm pulling method names as such ( as
seen in strip code ):
my $methods=
$self->meta->column_accessor_method_names_hash;
however, the column/value pairs way uses something of this sort:
$meta->column($column)->mutator_method_name;
which makes me wonnder if i should be looping
'column_mutator_method_names_hash'
can i have some feedback on what the difference is - in rose -
between the accessors and mutators ? i think i'm often seeing
accessors used where i'd expect mutators, and vice versa.
e) when restoring an object, I'm trying to figure out how stuff
the
foreign keys and relationships. i can bring them up as new objects
just fine, but there aren't really any rose methods for stuffing one
into an object. there's obviously an internal undocumented function
-- what is it ?
oh -- the new methods should be ready in a patch agains svn by monday
-- perhaps even tomorrow.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object