Just out of curiosity, is there a reason you prefer fetch mode PDO::FETCH_OBJ instead of an array? Personally I prefer arrays in that regard.
Then, while not absolutely necessary, maybe consider using un/serialize instead of json_en/decode. While encoding json is a tad faster at larger data sizes, serialize is optimized for use in closed PHP applications. See this page for reference. Also I'd prefer an array as the result of decoding, obviously wouldn't even be a question when using serialize. :)
https://github.com/FriendsOfShopware/FroshShareBasket/blob/238c7bfca6f1a10f9e42eb9d32452b31a21dc8d6/Controllers/Frontend/ShareBasket.php#L18
Just out of curiosity, is there a reason you prefer fetch mode
PDO::FETCH_OBJ
instead of an array? Personally I prefer arrays in that regard.Then, while not absolutely necessary, maybe consider using un/serialize instead of json_en/decode. While encoding json is a tad faster at larger data sizes, serialize is optimized for use in closed PHP applications. See this page for reference. Also I'd prefer an array as the result of decoding, obviously wouldn't even be a question when using serialize. :)