In PDO, the method setFetchMode is used to define how the data is obtained, in the case of the example you posted, the constant PDO::ASSOC is used to return the data in an associative array.
The methods fetch/fetchAll with the parameter PDO::ASSOC will obtain the data of a query in an associative array (because it uses the constant in question), in which case the method itself is specifying directly how the data will be returned. Generally, this is only necessary when the PDO has not previously been configured with the setFetchMode.
In case a return type is configured with setFetchMode, the parameter passed to the fetch/fetchAll is no longer precise. That is, the method setFetchMode lets configured the standard way to get the data so you don’t have to specify it later.