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>&nbsp;&nbsp;&nbsp; $meta = [];<br>&nbsp;&nbsp;&nbsp; if ($resource_type-&gt;includeCount()) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $link_context['total_count'] = $meta['count'] = $primary_data-&gt;getTotalCount();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; $collection_links = self::getPagerLinks($request, $page_param, $link_context);<br>&nbsp;&nbsp;&nbsp; $response = $this-&gt;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-&gt;create</code></p> > Related issue: [Issue #3111858](https://www.drupal.org/node/3111858) > Related issue: [Issue #3187221](https://www.drupal.org/node/3187221)
issue