1 | <?php |
||
2 | |||
3 | namespace Bdf\Prime\Connection\Result; |
||
4 | |||
5 | use Countable; |
||
6 | use Iterator; |
||
7 | |||
8 | /** |
||
9 | * Store result of the query execution |
||
10 | * The result set should not be reset |
||
11 | * |
||
12 | * <code> |
||
13 | * $connection |
||
14 | * ->execute($query) |
||
15 | * ->asColumn(2) |
||
16 | * ->all() |
||
17 | * ; |
||
18 | * </code> |
||
19 | * |
||
20 | * @template T |
||
21 | * @extends Iterator<int, T> |
||
22 | */ |
||
23 | interface ResultSetInterface extends Iterator, Countable |
||
24 | { |
||
25 | /** |
||
26 | * Fetch the rows as associative array |
||
27 | * This is the default fetch mode |
||
28 | * No options available |
||
29 | * |
||
30 | * @deprecated Use asAssociative() instead |
||
31 | */ |
||
32 | public const FETCH_ASSOC = 'assoc'; |
||
33 | |||
34 | /** |
||
35 | * Fetch the rows as a numeric array |
||
36 | * No options available |
||
37 | * |
||
38 | * @deprecated Use asList() instead |
||
39 | */ |
||
40 | public const FETCH_NUM = 'num'; |
||
41 | |||
42 | /** |
||
43 | * Fetch only one columns on each rows |
||
44 | * Option : integer column number to fetch. Starts at 0 (zero) |
||
45 | * |
||
46 | * @deprecated Use asColumn() instead |
||
47 | */ |
||
48 | public const FETCH_COLUMN = 'column'; |
||
49 | |||
50 | /** |
||
51 | * Fetch rows into a simple object (stdClass) |
||
52 | * No options available |
||
53 | * |
||
54 | * @deprecated Use asObject() instead |
||
55 | */ |
||
56 | public const FETCH_OBJECT = 'object'; |
||
57 | |||
58 | /** |
||
59 | * Fetch rows into a new class |
||
60 | * Option : string The class name |
||
61 | * |
||
62 | * @deprecated Use asClass() instead |
||
63 | */ |
||
64 | public const FETCH_CLASS = 'class'; |
||
65 | |||
66 | |||
67 | /** |
||
68 | * @param string $mode The fetch mode. Should be one of the ResultSetInterface::FETCH_* constant |
||
69 | * @param mixed $options |
||
70 | * |
||
71 | * @return $this |
||
72 | * |
||
73 | * @deprecated Use dedicated method instead |
||
74 | */ |
||
75 | public function fetchMode($mode, $options = null); |
||
76 | |||
77 | /** |
||
78 | * The result will be fetched as associative array |
||
79 | * |
||
80 | * Note: this is the default behavior of the connection |
||
81 | * |
||
82 | * @return static<array<string, mixed>> |
||
83 | */ |
||
84 | public function asAssociative(): self; |
||
85 | |||
86 | /** |
||
87 | * The value will be fetched as numeric array |
||
88 | * |
||
89 | * @return static<list<mixed>> |
||
90 | */ |
||
91 | public function asList(): self; |
||
92 | |||
93 | /** |
||
94 | * The result will be fetched as simple object (stdClass) |
||
95 | * |
||
96 | * @return static<\stdClass> |
||
97 | */ |
||
98 | public function asObject(): self; |
||
99 | |||
100 | /** |
||
101 | * The result will be fetched as an instance of a class |
||
102 | * |
||
103 | * Note: the entity will be instantiated first, and then properties will be filled |
||
104 | * |
||
105 | * @param class-string<E> $className The result class name |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
106 | * @param list<mixed> $constructorArguments Argument to pass at constructor |
||
107 | * |
||
108 | * @return static<E> |
||
109 | * |
||
110 | * @template E |
||
111 | */ |
||
112 | public function asClass(string $className, array $constructorArguments = []): self; |
||
113 | |||
114 | /** |
||
115 | * The result fetch only one column |
||
116 | * |
||
117 | * @param int $column The column number |
||
118 | * |
||
119 | * @return static<mixed> |
||
120 | */ |
||
121 | public function asColumn(int $column = 0): self; |
||
122 | |||
123 | /** |
||
124 | * Get all results as an array |
||
125 | * |
||
126 | * @return list<T> |
||
0 ignored issues
–
show
The type
Bdf\Prime\Connection\Result\list was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
127 | */ |
||
128 | public function all(): array; |
||
129 | |||
130 | /** |
||
131 | * {@inheritdoc} |
||
132 | * |
||
133 | * The rewind operation is not guaranteed to works, and may be a no-op on some connections |
||
134 | */ |
||
135 | public function rewind(): void; |
||
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | * |
||
140 | * Get the number of affected rows by an update operation |
||
141 | * Some drivers may return the number of rows for a select query, but it's not guaranteed |
||
142 | */ |
||
143 | public function count(): int; |
||
144 | |||
145 | /** |
||
146 | * Check if the result is for a read operation |
||
147 | * |
||
148 | * @return bool true if it's a read operation |
||
149 | */ |
||
150 | public function isRead(): bool; |
||
151 | |||
152 | /** |
||
153 | * Check if the result is for a write operation |
||
154 | * |
||
155 | * @return bool true if it's a write operation |
||
156 | */ |
||
157 | public function isWrite(): bool; |
||
158 | |||
159 | /** |
||
160 | * Does a write operation has been performed, and affected rows ? |
||
161 | * |
||
162 | * @return bool true if rows has been affected |
||
163 | */ |
||
164 | public function hasWrite(): bool; |
||
165 | } |
||
166 |