What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hey when you extend a DB table do you also need to extend the dataImport module that writes initial

U01JBB8LNTE
U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

Hey when you extend a DB table do you also need to extend the dataImport module that writes initial data? i.e. if I extended the spy_stock table with a field called description => console data:import:stock then I would need to update the writer step or something?

Comments

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    maybe in Orm/Zed ?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    or maybe I need to extend StockDataImport ?

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    If your new db field is a required one, then yes.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    hm... so if I extend the interface can I just add some new columns? the dataset looks like it's mapping from the interface

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    on project level it would be like StockDataImport/InsaneNumberOfDirectories/StockDataImportInterface.php and then drop a few new const COLUMNS_FIELD_NAME in there... or do I also need to extend the writer itself?

  • U01LKKBK97T
    U01LKKBK97T Posts: 287 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ah, now I'm getting it.
    In some cases, importing a new column might work out of the box, if your column name in csv matches the db column name and the importer is using fromArray and toArray stuff. You can just try it out, in worst case it will ignore your additional column, but doesn't break the import.

    In general, I'd recommend to check what hydrator (if any) and writer steps the specific importer is using. Most likely, you'll need some very simple adjustments there.

    What import are you going to extend? Is it an existing one from the demoshop?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yeh... extending data:import:stock if I'm understanding correctly the hydrator step may need some minor tweaking.

    I'll but together a shareable example Monday might be more informative than talking in the abstract.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hey @U01LKKBK97T so maybe I don't understand how to extend the writer step, maybe it needs a plugin? I didn't see a hydrator. Seems like updating the writing step would do it, but no dice... https://github.com/ed42311/spryker-antelope/pull/1 created the PR for a clean diff

  • U01A5ARAXP0
    U01A5ARAXP0 Posts: 119 πŸ§‘πŸ»β€πŸš€ - Cadet

    No... you can just extend the writer, but you also need to extend/override the business factory to ensure your class is instatiated instead of the Spryker one

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    Do you need to register you project classes in the project level factory? https://github.com/ed42311/spryker-antelope/pull/1/files

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    seems like there are a couple different ways to do this: https://documentation.spryker.com/docs/core-extension#extension-via-object-composition

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok I got the process to see my class anyway...

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    Alright got it to work. next question what DB field saves both upper and lowercase letters?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    maybe I didn't run propel and transfer

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    yup forgot to take unique off the table, so anyone have any thoughts about this composition versus direct extension?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 πŸ§‘πŸ»β€πŸš€ - Cadet

    Alright got it thanks for pointing me in the right direction @U01LKKBK97T @U01A5ARAXP0