Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit a12b575

Browse files
Merge pull request #672 from TobiasXy/master
split getResponse method to allow access to not encoded response data
2 parents 02bd8a9 + 7e811c8 commit a12b575

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

Response/DatatableResponse.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ public function getDatatableQueryBuilder()
114114
//-------------------------------------------------
115115

116116
/**
117-
* Get response.
117+
* Get response data as array.
118118
*
119119
* @param bool $countAllResults
120120
* @param bool $outputWalkers
121121
* @param bool $fetchJoinCollection
122122
*
123-
* @return JsonResponse
123+
* @return array
124124
* @throws Exception
125125
*/
126-
public function getResponse($countAllResults = true, $outputWalkers = false, $fetchJoinCollection = true)
126+
public function getData($countAllResults = true, $outputWalkers = false, $fetchJoinCollection = true)
127127
{
128128
if (null === $this->datatable) {
129129
throw new Exception('DatatableResponse::getResponse(): Set a Datatable class with setDatatable().');
@@ -145,7 +145,22 @@ public function getResponse($countAllResults = true, $outputWalkers = false, $fe
145145
'recordsTotal' => true === $countAllResults ? (int) $this->datatableQueryBuilder->getCountAllResults() : 0,
146146
);
147147

148-
return new JsonResponse(array_merge($outputHeader, $formatter->getOutput()));
148+
return array_merge($outputHeader, $formatter->getOutput());
149+
}
150+
151+
/**
152+
* Get response.
153+
*
154+
* @param bool $countAllResults
155+
* @param bool $outputWalkers
156+
* @param bool $fetchJoinCollection
157+
*
158+
* @return JsonResponse
159+
* @throws Exception
160+
*/
161+
public function getResponse($countAllResults = true, $outputWalkers = false, $fetchJoinCollection = true)
162+
{
163+
return new JsonResponse($this->getData($countAllResults, $outputWalkers, $fetchJoinCollection));
149164
}
150165

151166
//-------------------------------------------------

0 commit comments

Comments
 (0)