1 | <?php |
||
16 | class DoctrineDriver implements DriverInterface |
||
17 | { |
||
18 | const EVENT_GENERATE_SELECTS = 1; |
||
19 | const EVENT_GENERATE_JOINS = 2; |
||
20 | const EVENT_POST_GENERATE_QUERY_BUILDER = 3; |
||
21 | const EVENT_POST_FETCH = 4; |
||
22 | |||
23 | /** |
||
24 | * @var BuilderFactory |
||
25 | */ |
||
26 | private $queryBuilderBuilderFactory; |
||
27 | |||
28 | /** |
||
29 | * @param BuilderFactory $queryBuilderBuilderFactory |
||
30 | */ |
||
31 | public function __construct(BuilderFactory $queryBuilderBuilderFactory) |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function getData(DataSourceInterface $dataSource, QueryInterface $query) |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function getRecordCount(DataSourceInterface $dataSource, QueryInterface $query) |
||
64 | |||
65 | /** |
||
66 | * @param DataSourceInterface $dataSource |
||
67 | * @param QueryInterface $query |
||
68 | * |
||
69 | * @return \Doctrine\DBAL\Query\QueryBuilder|null |
||
70 | */ |
||
71 | public function getQueryBuilder(DataSourceInterface $dataSource, QueryInterface $query) |
||
78 | |||
79 | /** |
||
80 | * Transforms a fully-built query builder into a row collection with the results |
||
81 | * |
||
82 | * @param QueryBuilder $queryBuilder |
||
83 | * |
||
84 | * @param Query $query |
||
85 | * @param DataSourceInterface $dataSource |
||
86 | * |
||
87 | * @return array |
||
88 | * @throws ColumnNotSelectedException |
||
89 | * @throws \Netdudes\DataSourceryBundle\DataSource\Driver\Doctrine\Exception\ColumnNotFoundException |
||
90 | * |
||
91 | */ |
||
92 | protected function fetchData(QueryBuilder $queryBuilder, Query $query, DataSourceInterface $dataSource) |
||
118 | |||
119 | /** |
||
120 | * Helper method: gets the data of a defined data source field |
||
121 | * from a row of the database scalar results |
||
122 | * |
||
123 | * @param array $dataRow Plain array of data for a single row, from the database |
||
124 | * @param Field $dataSourceField |
||
125 | * |
||
126 | * @throws \Exception |
||
127 | * |
||
128 | * @return mixed |
||
129 | */ |
||
130 | protected function getCellValueByDataSourceField(array $dataRow, Field $dataSourceField, $fields) |
||
161 | |||
162 | private function findQueryBuilderDataSourceFieldByUniqueName($uniqueName, $fields) |
||
172 | } |
||
173 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.