Skip to content

Conversation

@duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Apr 10, 2024

This pull request makes various changes around the importer commands. Changes include but are not limited to:

  • Changed the console output, to improve styling.
  • Tweaked some of the language around command descriptions and argument descriptions.
  • Added tests to cover all of the importer commands
    • No tests existed for the importers until now. I had spotted a few errors in my manual testing so I was able to squash them by writing tests.
  • Fixed an issue when import form submissions
  • Fixed an error when importing asset containers
    • When the previous importer code was calling ->toModel(), it was touching was a core AssetContainer class which didn't have a toModel class on it, causing it to be sent through the augmentation stuff and error out.
    • I've added a new makeModelFromContract method to the AssetContainer class, which seems to be how the new importer implementations work.
  • Refactored the guards around determining which stuff should be imported, by introducing new shouldImport... methods.
  • Added --only-* arguments to some importers responsible for importing multiple things
    • These new arguments allow for doing --only-assets or --only-form-submission on importer commands which can import multiple things like importing asset containers & assets or forms & form submissions.

This PR started out small but grew arms and legs once I decided to add tests for everything 😆 .

Related: statamic/cms#9669.

To Do

  • Fix failing tests in ImportGlobalsTest
  • Add tests for all the importer commands
  • Fix failing tests in ImportEntriesTest
    • The tests seem to be importing entries with their old Stache ID, which is a string. However, the database migration is expecting an integer, causing it to fail. Setting the $shouldUseStringEntryIds property doesn't seem to help.
  • Fix issue with the collection importer when entries are in the Stache
    • Target class [statamic.eloquent.entries.model] does not exist.

…tamic/eloquent-driver into fix/add-arguments-to-import-commands
@duncanmcclean duncanmcclean marked this pull request as ready for review April 11, 2024 19:31
@duncanmcclean duncanmcclean changed the title Add arguments to import commands for more granularity over what's imported Importer Improvements Apr 11, 2024
@duncanmcclean duncanmcclean mentioned this pull request May 1, 2024
2 tasks
@jasonvarga jasonvarga merged commit b3b2d76 into statamic-5 May 2, 2024
@jasonvarga jasonvarga deleted the fix/add-arguments-to-import-commands branch May 2, 2024 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants