The EntityFactory builds the
Swader\Diffbot\Entity\EntityIterator by providing it with a collection of entities returned by an API, and a Guzzle Response which to consume. It implements the
The only reason to build your own version of the EntityFactory is to provide it with instructions on how to pair API return types and entities you developed by extending
For a concrete example of this, see this tutorial on SitePoint, which demonstrates custom “AuthorFolio” and “SitePointArticle” entities automatically created by calls to a custom API.
- $response (GuzzleHttp\Message\ResponseInterface) – The Guzzle response given by the Guzzle client after an API call’s execution
The only method publicly accessible, and the only method one needs to implement when building one’s own EntityFactory,
createAppropriateIteratordoes what it says - it takes the Guzzle response provided to it, and builds an EntityIterator - a collection of Entities fitting for an API’s result.