frioux / DBIx-Class-Helpers

https://metacpan.org/pod/DBIx::Class::Helpers
20 stars 38 forks source link

Q: Why `Helper::Row::SelfResultSet` disables `InflateColumn::DateTime` if used first? #91

Open KES777 opened 6 years ago

KES777 commented 6 years ago

When I load components at this order:

Helper::Row::SelfResultSet
InflateColumn::DateTime

The DateTime fields are not deflated:

At point: https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.082841/lib/DBIx/Class/Row.pm#L407

the $self object is:

DBG>$self
HyperMouse::Schema::Result::Contractor {
  _column_data => {
    contractor_type_id => 1,
    known_from => DateTime 2018-07-13T13:18:24,
    known_till => DateTime 9999-12-31T23:59:59,
    name => Contractor,
    provider => 1,
    valid_from => DateTime 2018-07-13T13:18:24,
    valid_till => DateTime 9999-12-31T23:59:59,
  },
  _in_storage => 0,
  _result_source => IGNORED,
}

In compare when Helper::Row::SelfResultSet is last loaded component:

HyperMouse::Schema::Result::Contractor {
  _column_data => {
    contractor_type_id => 1,
    name => Contractor,
    provider => 1,
  },
  _in_storage => 0,
  _inflated_column => {
    known_from => DateTime 2018-07-13T13:19:47,
    known_till => DateTime 9999-12-31T23:59:59,
    valid_from => DateTime 2018-07-13T13:19:47,
    valid_till => DateTime 9999-12-31T23:59:59,
  },
  _rel_in_storage => {},
  _result_source => IGNORED,
}
frioux commented 6 years ago

Can you write a test that I can just run? You should be able to see if a $row has a compenent loaded by checking $row->isa('DBIx::Class::Helper::SelfResultSet'), for example.

ribasushi commented 6 years ago

@KES777 this is a known-ish issue within DBIC-land. I really hope I will be able to get a trial release of DBIC addressing this soon for you to try, but it's been setback after setback lately :( Stay tuned!