Most of the code reviewed... Missing ResultSet->populate, ResultSet->find, Row->copy...
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / Schema / Artist.pm
index af6257c..f519fe4 100644 (file)
@@ -49,13 +49,18 @@ __PACKAGE__->has_many(
 __PACKAGE__->has_many(
     cds_80s => 'DBICTest::Schema::CD',
     sub {
-      my ( $me, $as, $self_rsrc, $rel ) = @_;
-      return {
-        "${as}.artist" => (ref $me ? $me->artistid : { '=' => \"${me}.artistid"}),
-        "${as}.year"   => { '>', "1979",
-                            '<', "1990" }
-      };
-    }
+      my ( $me_alias, $rel_alias, $me_result_source, $rel_name, $optional_me_object ) = @_;
+      return
+        ({ "${rel_alias}.artist"  => { '=' => \"${me_alias}.artistid"},
+           "${rel_alias}.year"    => { '>', "1979",
+                                       '<', "1990" }
+         },
+         $optional_me_object &&
+         { "${rel_alias}.artist" => $optional_me_object->artistid,
+           "${rel_alias}.year"   => { '>', "1979",
+                                      '<', "1990" }
+       });
+  }
 );