mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Add Archive download to Api v2 orders
This commit is contained in:
@@ -84,6 +84,21 @@ class OrderViewBuilder
|
||||
*/
|
||||
private function fillViews(array $views, array $includes)
|
||||
{
|
||||
array_walk($views, function (OrderView $view) {
|
||||
// Archive is only available when a Basket is associated with the order (at least one element was accepted)
|
||||
if (null === $basket = $view->getOrder()->getBasket()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($basket->getElements()->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$view->setArchiveUrl($this->application->url('api_v2_orders_archive', [
|
||||
'orderId' => $view->getOrder()->getId(),
|
||||
]));
|
||||
});
|
||||
|
||||
if (!in_array('elements', $includes, true)) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user