zapytanie na obiekt w symfony

   public function getDataToRefundByOrderUniqueHash(string $orderUniqueHash): RefundDataDTOCollection
    {
        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder
            ->select(
                'o.id as orderId,
                o.customer_id as customerId,
                o.unique_hash as uniqueHash,
                o.website_id as websiteId,
                oi.id as orderItemId'
            )
            ->from('order_related', 'orr')
            ->innerJoin('orr', '`order`', 'o', 'orr.order_id = o.id')
            ->innerJoin('orr', '`order_item`', 'oi', 'orr.order_id = oi.order_id')
            ->where('orr.order_related_id IN (SELECT id FROM `order` WHERE unique_hash = :uniqueHash)')
            ->andWhere('o.deleted_at IS NULL AND o.archival = 0')
            ->groupBy('orderItemId')
            ->setParameter('uniqueHash', $orderUniqueHash, PDO::PARAM_STR);

        $stmt = $queryBuilder->execute();

        return new RefundDataDTOCollection($stmt->fetchAll(PDO::FETCH_CLASS, RefundDataDTO::class));
    }
Komentarze wyłączone