/** * @param SelectInterface $select * @param string $mode * @param int|null $extraArg * @return array|string|false */ public static function fetch(SelectInterface $select, $mode = "assoc", $extraArg = null) { $method = "fetch" . ucwords($mode); if ($extraArg === null) { return self::$conn->{$method}($select->getStatement(), $select->getBindValues()); } else { return self::$conn->{$method}($select->getStatement(), $select->getBindValues(), $extraArg); } }
public function fetchResult(SelectInterface $select) { $result = null; $stmt = $select->getStatement(); try { $statement = $this->db->prepare($stmt); $statement->execute($select->getBindValues()); $result = $statement->fetch(); } catch (PDOException $e) { $this->logger->error($select->__toString()); $this->logger->error($e->getMessage()); return null; } return $result ?: null; }