Skip to content

Conversation

@emmadesilva
Copy link
Member

@emmadesilva emmadesilva commented Aug 5, 2024

Abstract

Changes

  • Makes the public readonly metadata properties protected and only accessible via getter methods
  • Lazy loads metadata properties using a boot system, which constructs all metadata properties when one is accessed (and when instance is serialized to array), and then caches them for future access
  • No longer validates file existence in the constructor, but instead on boot, making it possible to create memory based file objects which opens up the API for more use cases, at the cost of inconsistent places where the file existence is checked but still having a robust system in place for when trying to get filesystem information for a non-existent file

@codecov
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.93%. Comparing base (5ba193a) to head (0fbbf2d).

Additional details and impacted files
@@                      Coverage Diff                      @@
##             normalize-the-asset-api    #1933      +/-   ##
=============================================================
- Coverage                      99.97%   99.93%   -0.05%     
- Complexity                      1883     1887       +4     
=============================================================
  Files                            193      193              
  Lines                           4971     4978       +7     
=============================================================
+ Hits                            4970     4975       +5     
- Misses                             1        3       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@emmadesilva emmadesilva force-pushed the bring-media-assets-into-the-hyde-kernel branch from 3fb3f11 to b61d957 Compare August 5, 2024 14:06
if (! isset($this->length)) {
$this->boot();
}
$this->ensureInstanceIsBooted('length');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we could do something like $this->getBootedProperty() but I think this is much more readable and understandable.

@emmadesilva emmadesilva mentioned this pull request Aug 5, 2024
21 tasks
@emmadesilva emmadesilva marked this pull request as ready for review August 5, 2024 17:17
@emmadesilva emmadesilva merged commit 6cf60bf into normalize-the-asset-api Aug 5, 2024
@emmadesilva emmadesilva deleted the bring-media-assets-into-the-hyde-kernel branch August 5, 2024 17:17
emmadesilva added a commit that referenced this pull request Aug 7, 2024
…e-kernel

[2.x] Lazy loaded MediaFile metadata properties
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

Successfully merging this pull request may close these issues.

2 participants