Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KES777 opened this issue Jul 13, 2018 · 2 comments

Comments

@KES777
Copy link

KES777 commented Jul 13, 2018

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
Copy link
Owner

frioux commented Jul 20, 2018

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
Copy link
Contributor

@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!

dakkar added a commit to dakkar/DBIx-Class-Helpers that referenced this issue Feb 27, 2020
having helpers inherit from Row, ResultSet &c causes problems when
loading multiple components: some base classes appear before
components in C3 resolution, and component methods get skipped

See for example issue frioux#91
dakkar added a commit to dakkar/DBIx-Class-Helpers that referenced this issue Feb 27, 2020
the problem happens when iheriting from a class that `load_components`

I suspect the root of the problem is that the derived class doesn't
use C3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants