Data passed by DataBin Grid functionality. $this->em->clear(); ini_set('memory_limit','512M'); foreach ($this->_data as $rowId => $rowData) { $this->_data[$rowId]['salesProfile_fullName'] = isset($rowData['salesProfile_firstName']) && !empty($rowData['salesProfile_firstName']) ? $rowData['salesProfile_firstName'] . ' ' . $rowData['salesProfile_familyName'] : ''; $this->_data[$rowId]['managerProfile_fullName'] = isset($rowData['managerProfile_firstName']) && !empty($rowData['managerProfile_firstName']) ? $rowData['managerProfile_firstName'] . ' ' . $rowData['managerProfile_familyName'] : ''; if (is_null($rowData['priceGuide_id'])) { $this->_data[$rowId]['higestoffernames'] = ''; continue; } $query = 'SELECT priceGuideOffer, company ' . 'FROM \PriceGuide\Entity\Offer priceGuideOffer ' . 'JOIN priceGuideOffer.company company ' . 'WHERE IDENTITY(priceGuideOffer.priceGuideStock) = :priceGuideId' . ' AND priceGuideOffer.amount = :highestOffer'; $query = $this->em->createQuery($query); $query->setParameter('priceGuideId', $rowData['priceGuide_id']); $query->setParameter('highestOffer', $rowData['stock_highestOffer']); $resultx = $query->getArrayResult(); $this->em->clear(); if (empty($resultx)) { $this->_data[$rowId]['higestoffernames'] = ''; continue; } $dealers = array(); foreach($resultx as $itemx) { $dealers[] = $itemx['company']['name']; } $this->_data[$rowId]['higestoffernames'] = implode(', ', $dealers); } foreach ($this->_data as $rowId => $rowData) { if ($this->_data[$rowId]['stock_tradePrice'] == 0) { $this->_data[$rowId]['valuation_updated'] = '0 %'; } else { $this->_data[$rowId]['valuation_updated'] = round(($this->_data[$rowId]['valuation_amountOffered'] * 100) / $this->_data[$rowId]['stock_tradePrice']) . ' %' ; } } } }