I have no idea why my getSelect printing query without echo & __toString.
public function loadOrdersCollection($orders): mixed
{
$pac_orders = array();
$orderCollection = $this->orderCollection->create()->addFieldToFilter('increment_id', $orders, 'in');
$paymentMethods = explode(',', $this->getPaymentMethods());
/* join with payment table */
$joinQuery = $orderCollection->getSelect()
->join(["sales_order_payment"],
'main_table.entity_id = sales_order_payment.parent_id',
array('method')
)
->where('sales_order_payment.method IN (?)', $paymentMethods);
$orders = $orderCollection->load($joinQuery)->getData();
foreach ($orders as $order) {
$pac_orders[] = $order['increment_id'];
}
return $pac_orders;
}
i am getting following output without any echo & print_r. no idea what’s going on
SELECT `main_table`.*, `sop`.`po_number`, `sales_order_payment`.`method` FROM `sales_order` AS `main_table` INNER JOIN `sales_order_payment` AS `sop` ON main_table.entity_id = sop.parent_id INNER JOIN `sales_order_payment` ON main_table.entity_id = sales_order_payment.parent_id WHERE (((`increment_id` = '01') OR (`increment_id` = '00') OR (`increment_id` = '00') OR (`increment_id` = '0000990') OR (`increment_id` = '1064535890') OR (`increment_id` = '00') OR (`increment_id` = '10000XXXXX') OR (`increment_id` = '0000146') OR (`increment_id` = '00') OR (`increment_id` = '10000XXXXX'))) AND (sales_order_payment.method IN ('chcybersource', 'cybersourceecheck'))SELECT `main_table`.*, `sop`.`po_number`, `sales_order_payment`.`method` FROM `sales_order` AS `main_table` INNER JOIN `sales_order_payment` AS `sop` ON main_table.entity_id = sop.parent_id INNER JOIN `sales_order_payment` ON main_table.entity_id = sales_order_payment.parent_id WHERE (((`increment_id` = '01') OR (`increment_id` = '00') OR (`increment_id` = '00') OR (`increment_id` = '0000990') OR (`increment_id` = '1064535890') OR (`increment_id` = '00') OR (`increment_id` = '10000XXXXX') OR (`increment_id` = '0000146') OR (`increment_id` = '00') OR (`increment_id` = '10000XXXXX'))) AND (sales_order_payment.method IN ('chcybersource', 'cybersourceecheck'))
please help