/**
  * @param string $query
  * @param array  $parameters
  * @param string $fetchMode
  *
  * @return array
  */
 public function fetchAll($query, array $parameters = array(), $fetchMode = null)
 {
     $parameters = $this->parameterTransformer->transform($parameters);
     $this->stopWatch->start('query', 'database');
     $result = $this->reader->fetchAll($query, $parameters, $fetchMode);
     $event = $this->stopWatch->stop('query');
     $this->log($query, $parameters, $event, 'fetch', 'all');
     return $result;
 }
示例#2
0
 /**
  * Gets a bunch of \Berthe\AbstractVOVO from database from their ids
  * @param array $ids
  * @return \Berthe\VO
  */
 public function selectByIds(array $ids = array())
 {
     if (empty($ids)) {
         return array();
     }
     $ids = array_map('intval', $ids);
     $sql = $this->getSelectQueryByIds($ids);
     $resultSet = $this->db->fetchAll($sql);
     return $this->implementVOs($resultSet);
 }
    public function getAll()
    {
        $sql = <<<SQL
SELECT
    md5key,
    lang,
    key,
    value
FROM
    translations_engine
ORDER BY
    md5key ASC,
    lang ASC
SQL;
        $resultSet = $this->reader->fetchAll($sql);
        $output = array();
        foreach ($resultSet as $row) {
            if (!array_key_exists($row['key'], $output)) {
                $output[$row['key']] = array();
            }
            $output[$row['key']][$row['lang']] = $row['value'];
        }
        return $output;
    }