Support meta.count on paginated collections
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3120437. -->
Reported by: [mglaman](https://www.drupal.org/user/2416470)
Related to !32
>>>
<p>\Drupal\jsonapi\Controller\EntityResource::respondWithCollection has the following code</p>
<pre> $meta = [];<br> if ($resource_type->includeCount()) {<br> $link_context['total_count'] = $meta['count'] = $primary_data->getTotalCount();<br> }<br> $collection_links = self::getPagerLinks($request, $page_param, $link_context);<br> $response = $this->buildWrappedResponse($primary_data, $request, $includes, 200, [], $collection_links, $meta);</pre><p>This ensures a primary data with count is available. We can perform the same $meta check in createJsonapiResponse before we call <code>resourceResponseFactory->create</code></p>
> Related issue: [Issue #3111858](https://www.drupal.org/node/3111858)
> Related issue: [Issue #3187221](https://www.drupal.org/node/3187221)
issue