I have an endpoint that returns an array of Order entities, but it's caching the results so when a new order is placed the cache has to be cleared.
The code within the endpoint is:
// Tried this also. // $this->orderManager->resetCache() $orders = $this->orderManager->loadByProperties([ 'uid' => $this->customer->id(), ]); $response = new ResourceResponse($orders); // maybe this doesn't work because it's an \Drupal\Entity\commerce\Order $response->addCacheableDependency($orders); return new ResourceResponse($orders);
What am I missing?