use Scalar::Util 'blessed';
use namespace::clean;
-# FIXME - both of these *PROBABLY* need to be 'inherited_ro_instance' type
__PACKAGE__->mk_classaccessor(table_class => 'DBIx::Class::ResultSource::Table');
# FIXME: Doesn't actually do anything yet!
__PACKAGE__->mk_group_accessors( inherited => 'table_alias' );
=cut
sub table {
- return $_[0]->result_source_instance->name unless @_ > 1;
+ return $_[0]->result_source->name unless @_ > 1;
my ($class, $table) = @_;
: undef
;
+ # Folks calling ->table on a class *might* expect the name
+ # to shift everywhere, but that can't happen
+ # So what we do is mark the ancestor as "dirty"
+ # even though it will have no "derived" link to the one we
+ # will use afterwards
+ if(
+ defined $ancestor
+ and
+ $ancestor->name ne $table
+ and
+ scalar $ancestor->__derived_instances
+ ) {
+ # Trigger the "descendants are dirty" logic, without giving
+ # it an explicit externally-callable interface
+ # This is ugly as sin, but likely saner in the long run
+ local $ancestor->{__in_rsrc_setter_callstack} = 1
+ unless $ancestor->{__in_rsrc_setter_callstack};
+ my $old_name = $ancestor->name;
+ $ancestor->set_rsrc_instance_specific_attribute( name => "\0" );
+ $ancestor->set_rsrc_instance_specific_attribute( name => $old_name );
+ }
+
+
my $table_class = $class->table_class;
$class->ensure_class_loaded($table_class);