| Total Complexity | 3 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class PDOQuery extends Query |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $results = null; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Hook the result-set given into a Query class, suitable for use by SilverStripe. |
||
| 21 | * @param PDOStatement $statement The internal PDOStatement containing the results |
||
| 22 | */ |
||
| 23 | public function __construct(PDOStatementHandle $statement) |
||
| 24 | { |
||
| 25 | // Since no more than one PDOStatement for any one connection can be safely |
||
| 26 | // traversed, each statement simply requests all rows at once for safety. |
||
| 27 | // This could be re-engineered to call fetchAll on an as-needed basis |
||
| 28 | |||
| 29 | $this->results = $statement->typeCorrectedFetchAll(); |
||
| 30 | $statement->closeCursor(); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function getIterator() |
||
| 36 | } |
||
| 37 | |||
| 38 | public function numRecords() |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: