public function getTranslations($locale, $criteria, $hierarchicalArray = true) { $sql = vsprintf('SELECT `%s` AS `key`, `%s` AS `message` FROM `%s` WHERE `%s` = :locale AND `%s` = :domain', array($this->getColumnname('key'), $this->getColumnname('message'), $this->getTablename(), $this->getColumnname('locale'), strpos('Bundle', $criteria) !== false ? $this->getColumnname('domain') : $this->getColumnname('bundle'))); $stmt = $this->getConnection()->prepare($sql); $stmt->bindParam('locale', $locale); if (strpos('Bundle', $criteria) !== false) { $stmt->bindParam('bundle', $criteria); } else { $stmt->bindParam('domain', $criteria); } if (false === $stmt->execute()) { throw new \RuntimeException('Could not fetch translation data from database.'); } $result = array(); while ($row = $stmt->fetch()) { $result[$row['key']] = $row['message']; } if ($hierarchicalArray) { return ArrayTools::keyedAssocToHierarchical($result); } return $result; }