Skip to content
This repository was archived by the owner on Jul 27, 2020. It is now read-only.

Commit 865d59d

Browse files
committed
Ajustes função retorno
1 parent ea2b642 commit 865d59d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/Core/DoctrineBaseRepository.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -852,24 +852,19 @@ public function readQuery(string $typeTreat = '', array $treatObject = []): obje
852852
if (count($response) > 0) {
853853
$result[$this->configLdr['indexNameResultsArray']] = $response;
854854
} else {
855-
return (object) [];
855+
return [];
856856
}
857857

858858
//add pagination
859859
if ($query->getFirstResult() !== null && count($result[$this->configLdr['indexNameResultsArray']]) > 0) {
860860
$result = $this->responsePaginator($result);
861861
}
862862

863-
//treat object
864-
if ($treatObject) {
865-
return $this->treatObject($result, $typeTreat, $treatObject);
866-
}
867-
868863
//clear hydration
869864
$this->resultHydration = null;
870865

871-
//return result without treat object
872-
return json_decode($this->serializer->serialize($result, 'json'));
866+
//treat object
867+
return $this->treatObject($result, $typeTreat, $treatObject);
873868
}
874869

875870
/**
@@ -1802,7 +1797,7 @@ private function instanceSerializer($objectNormalizer = null)
18021797
*
18031798
* @return object
18041799
*/
1805-
private function serializerNormalize($obj, array $atributes): object
1800+
private function serializerNormalize($obj, array $atributes)
18061801
{
18071802
if ($this->return == 'array') {
18081803
return json_decode(json_encode($this->serializer->normalize($obj, null, [
@@ -1824,7 +1819,7 @@ private function serializerNormalize($obj, array $atributes): object
18241819
*
18251820
* @return object
18261821
*/
1827-
private function serializerIgnoreAttributes($obj, array $values): object
1822+
private function serializerIgnoreAttributes($obj, array $values)
18281823
{
18291824
$normalizer = new ObjectNormalizer();
18301825
$normalizer = $normalizer->setIgnoredAttributes($values);
@@ -1847,7 +1842,7 @@ private function serializerIgnoreAttributes($obj, array $values): object
18471842
*
18481843
* @return object
18491844
*/
1850-
protected function treatObject($obj, string $type, array $values): object
1845+
protected function treatObject($obj, string $type, array $values)
18511846
{
18521847
$perm = ['included', 'excluded'];
18531848
if ($values && in_array($type, $perm)) {

0 commit comments

Comments
 (0)