X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=228ade30c3cff25fd61db8d39472f17c4df13cc9;hb=7f3fd2621c5509873aa30e7a68b7dd670421cc86;hp=d7bcd7238653ca434cfdf097331462778143d1ab;hpb=8b9473f535c78bab500ff7e1258bd9fcab3e4ff6;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index d7bcd72..228ade3 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -886,12 +886,21 @@ sub unique_constraint_columns { =over -=item Arguments: $callback +=item Arguments: $callback_name | \&callback_code + +=item Return value: $callback_name | \&callback_code =back __PACKAGE__->sqlt_deploy_callback('mycallbackmethod'); + or + + __PACKAGE__->sqlt_deploy_callback(sub { + my ($source_instance, $sqlt_table) = @_; + ... + } ); + An accessor to set a callback to be called during deployment of the schema via L or L. @@ -899,7 +908,7 @@ L. The callback can be set as either a code reference or the name of a method in the current result class. -If not set, the L is called. +Defaults to L. Your callback will be passed the $source object representing the ResultSource instance being deployed, and the @@ -919,19 +928,13 @@ and call L. =head2 default_sqlt_deploy_hook -=over - -=item Arguments: $source, $sqlt_table - -=item Return value: undefined - -=back - -This is the sensible default for L. - -If a method named C exists in your Result class, it -will be called and passed the current C<$source> and the -C<$sqlt_table> being deployed. +This is the default deploy hook implementation which checks if your +current Result class has a C method, and if present +invokes it B. This is to preserve the +semantics of C which was originally designed to expect +the Result class name and the +L<$sqlt_table instance|SQL::Translator::Schema::Table> of the table being +deployed. =cut @@ -1578,7 +1581,7 @@ sub _resolve_condition { # FIXME sanity check until things stabilize, remove at some point $self->throw_exception ( - "A join-free condition returned for relationship '$relname' whithout a row-object to chain from" + "A join-free condition returned for relationship '$relname' without a row-object to chain from" ) unless $obj_rel; # FIXME another sanity check