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..

Hello team, is there a way to return a Generator from the QueryContainer? I don`t want to load all d

Chemaclass
Chemaclass Tech Lead Spryker Solution Partner Posts: 213 πŸ§‘πŸ»β€πŸš€ - Cadet

Hello team, is there a way to return a Generator from the QueryContainer? I don`t want to load all data in an array, but rather return a Generator instead.

Comments

  • generally a pretty good idea

  • but πŸ˜‰

  • Unknown
    edited September 2020

    the query container returns unterminated propel queries

  • UKJND3A3H
    UKJND3A3H Posts: 123 πŸ§‘πŸ»β€πŸš€ - Cadet

    so rather a question for repository then?

  • Unknown
    edited September 2020

    so, this would have to be implemented in propel

  • UKJND3A3H
    UKJND3A3H Posts: 123 πŸ§‘πŸ»β€πŸš€ - Cadet

    ha, and that πŸ€”

  • Chemaclass
    Chemaclass Tech Lead Spryker Solution Partner Posts: 213 πŸ§‘πŸ»β€πŸš€ - Cadet

    Currently I have in my Repository this
    return $query->find()->getData();
    And I was wondering if it's possible to return a Generator instead of calling the find() πŸ€”

  • fortunately though πŸ˜„

  • propel is an opn source repository πŸ˜„

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited September 2020

    Actually you need to open a cursor to DB for a generator to make sense but as far as I know propel does not expose PDOStatement::fetch

  • Chemaclass
    Chemaclass Tech Lead Spryker Solution Partner Posts: 213 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yeah. I think the proper way would be to return a Generator of transfer objects (yielying each one), after doing the find()query. Thanks for the ideas :)