Having played around with Fey::ORM, I am quite convinced that it is a bad route to go.

Personally, if I were the author of Fey::ORM I would most certainly work to keep the documentation up to date. The example code in the POD is broken -- the interface changes and the docs do not get updated correctly. I have spent much time reading the source code, which is not easy to follow.

The problem is still the same. If you have a single table then creating an object that represents it is simple -- but as soon as you starting throwing in relationships you are going to start hurting.

I have two tables that are joined by a cross reference table -- each row of the cross reference table contains one id from the first table, and one id from the second table. I can not for the life of me figure why this won't work:

package Foo; use Schema; use Fey::ORM::Table; use Fey::SQL; use Fey::Placeholder; my $schema = Schema->Schema(); my $foo_table = $schema->table( 'foo' ); my $bar_table = $schema->table( 'bar' ); my $writer_xref = $schema->table( 'bar_xref' ); has_table $foo_table; my $sql = Fey::SQL->new_select(); $sql->select( 'bar_id' ); $sql->from( $bar_xref ); $sql->where( $bar_xref->column( 'foo_id' ), '=', Fey::Placeholder->new + ); has_many 'bars' => ( table => $schema->table('bar'), select => $sql, bind_params => sub { $_[0]->id }, ); 1;
But when I instantiate a Foo object, the following error which is so completely useless is spewed forth:
Use of uninitialized value in join or string at /usr/lib/perl5/site_pe +rl/5.8.8/Fey/ORM/Role/Iterator.pm line 20. Attribute (classes) does not pass the type constraint because: Must be + an array reference of Fey::Object::Table subclasses and you passed [ +] at /usr/lib/perl5/site_perl/5.8.8/Fey/Meta/HasMany.pm line 98 Foo::bars('Movie=HASH(0x9322704)') called at ./foo.pl line 11
Where do I even begin my long list of complaints? How about not being able to pass in a text string of SQL? Instead I have to make an object. Ugh.

Thanks for your help, but I am not happy with Fey::ORM. Not one single bit. Perhaps if the Fey::ORM docs were production ready ... perhaps if the author(s) would take a little time to give better examples. I mean ... they do want us to use their code, correct? Perhaps they just want to cause pain and suffering. ;)


In reply to Re^8: Moose + ORM by Anonymous Monk
in thread Moose + ORM by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.