Skip to content

Fix transaction status collection not filtered very efficiently#502

Open
ma4nn wants to merge 1 commit intoPAYONE-GmbH:masterfrom
ma4nn:fix_non_performant_transaction_collection_query
Open

Fix transaction status collection not filtered very efficiently#502
ma4nn wants to merge 1 commit intoPAYONE-GmbH:masterfrom
ma4nn:fix_non_performant_transaction_collection_query

Conversation

@ma4nn
Copy link

@ma4nn ma4nn commented Aug 25, 2024

This PR fixes a huge performance drawback introduced by the change in 5231b7ff in the transaction status controller.

The issue is caused by the fact that the collection is not filtered on database level resulting in all status entries being loaded.

@leissbua
Copy link

leissbua commented Dec 4, 2024

Guys at Payone should merge this, the current way is quite stupid, as they load the whole collection each time:

    /**
     * Search all items by field value
     *
     * @param   string $column
     * @param   mixed $value
     * @return  array
     */
    public function getItemsByColumnValue($column, $value)
    {
        $this->load();

        $res = [];
        foreach ($this as $item) {
            if ($item->getData($column) == $value) {
                $res[] = $item;
            }
        }
        return $res;
    }

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