File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,9 +148,13 @@ public function asClass(?string $class = null): self
148148 /**
149149 * @inheritDoc
150150 */
151- public function asObject (): self
151+ public function asObject (? object $ obj = null ): self
152152 {
153- $ this ->getStatement ()->setFetchMode (PDO ::FETCH_OBJ );
153+ if (null !== $ obj ) {
154+ $ this ->getStatement ()->setFetchMode (PDO ::FETCH_INTO , $ obj );
155+ } else {
156+ $ this ->getStatement ()->setFetchMode (PDO ::FETCH_OBJ );
157+ }
154158
155159 return $ this ;
156160 }
Original file line number Diff line number Diff line change @@ -82,10 +82,11 @@ public function numRows(): int;
8282 public function asClass (?string $ class = null ): self ;
8383
8484 /**
85+ * @param null|object $obj
8586 * @return self
8687 * @throws DataMapperException
8788 */
88- public function asObject (): self ;
89+ public function asObject (? object $ obj = null ): self ;
8990
9091 /**
9192 * @return self
You can’t perform that action at this time.
0 commit comments