Search Criteria Interface for list filtering
Knowing how to do a proper list filtering to fetch the entities that match a certain lookup is essential for the effective use of getList
services across core Magento and possibly custom-coded API's. An example is fetching the list of customers registered within the last 24 hours for the latest added product.
Let's take a look back at our app/code/Foggyline/Slider/etc/webapi.xml
file, the bit where we defined the service method="getList"
. The service class is defined as Foggyline\Slider\Api\SlideRepositoryInterface
, which is defined as a preference for the Foggyline\Slider\Model\SlideRepository
class. Finally, within the SlideRepository
class, we have the actual getList
. Method getList
is defined as ...
Get Magento 2 Developer's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.