0

Only one thing I need is to rename all result fields from PHPNAME type into FIELDNAME. I'm running such query:

$members = MemberQuery::create()->filterByOrganizerId($organizerId)
        ->setFormatter($formatter)
        ->useTableOneQuery()
            ->useTableTwoQuery()
                ->where('TableTwo.Status != ?', TableTwo::STATUS_FAILED)
            ->endUse()
        ->endUse()
        ->groupById()
        ->paginate($page, $pageSize);

Where $formatter is:

    $arrayDataFetcher = new ArrayDataFetcher([]);
    $arrayDataFetcher->setIndexType(TableMap::TYPE_FIELDNAME);

    $formatter= new ArrayFormatter();
    $formatter->setDataFetcher($arrayDataFetcher);

But every array is still having PHPNAME fieldnames. When I do not paginate results and just using find() I can simply use toArray on result and everything is okay, but I can't figure out how to do the same with paginated results

Grokking
  • 665
  • 8
  • 16

1 Answers1

0

solution is pretty easy. Just use toArray() on your result. Do not trust autocomplete. IDE do not shows that method, but it exists! Trust documentation, check here, and you will see comment that paginated results behave like collection, that's exactly what we need.

Grokking
  • 665
  • 8
  • 16