getFetchMode() public method

Get the default fetch mode for the connection.
public getFetchMode ( ) : integer
return integer
 /**
  * {@inheritdoc}
  */
 public function findMask(RequesterInterface $requester, ResourceInterface $resource)
 {
     $oldFetchMode = $this->connection->getFetchMode();
     $this->connection->setFetchMode(\PDO::FETCH_COLUMN);
     if (null === ($mask = $this->connection->selectOne('SELECT mask FROM ' . $this->getAclSchema()->getPermissionsTableName() . ' WHERE requester = :requester AND resource = :resource', ['requester' => $requester->getAclRequesterIdentifier(), 'resource' => $resource->getAclResourceIdentifier()]))) {
         $this->connection->setFetchMode($oldFetchMode);
         throw new MaskNotFoundException();
     }
     $this->connection->setFetchMode($oldFetchMode);
     return (int) $mask;
 }
示例#2
0
 /**
  * Get all migrated version numbers
  *
  * @return array
  */
 public function fetchAll()
 {
     $fetchMode = $this->adapter->getFetchMode();
     $all = $this->adapter->table($this->tableName)->orderBy('version')->get();
     return array_map(function ($v) use($fetchMode) {
         switch ($fetchMode) {
             case PDO::FETCH_OBJ:
                 return $v->version;
             case PDO::FETCH_ASSOC:
                 return $v['version'];
             default:
                 throw new RuntimeException("The PDO::FETCH_* constant {$fetchMode} is not supported");
         }
     }, $all);
 }