mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Remove SubdefViewModel as currently useless
This commit is contained in:
@@ -304,27 +304,19 @@ class ApiOrderController extends BaseOrderController
|
|||||||
|
|
||||||
// Load all subdefs
|
// Load all subdefs
|
||||||
$subdefs = $this->app['service.media_subdef']->findSubdefsFromRecordReferenceCollection($records);
|
$subdefs = $this->app['service.media_subdef']->findSubdefsFromRecordReferenceCollection($records);
|
||||||
$links = \media_Permalink_Adapter::getMany($this->app, $subdefs);
|
\media_Permalink_Adapter::getMany($this->app, $subdefs);
|
||||||
|
|
||||||
$orderableViews = [];
|
$orderableSubdefs = [];
|
||||||
|
|
||||||
$views = array_map(null, $subdefs, $links);
|
|
||||||
|
|
||||||
foreach ($views as $view) {
|
|
||||||
/**
|
|
||||||
* @var \media_subdef $subdef
|
|
||||||
* @var \media_Permalink_Adapter $link
|
|
||||||
*/
|
|
||||||
list ($subdef, $link) = $view;
|
|
||||||
|
|
||||||
|
foreach ($subdefs as $subdef) {
|
||||||
$databoxId = $subdef->get_sbas_id();
|
$databoxId = $subdef->get_sbas_id();
|
||||||
$recordId = $subdef->get_record_id();
|
$recordId = $subdef->get_record_id();
|
||||||
|
|
||||||
if (!isset($orderableViews[$databoxId][$recordId])) {
|
if (!isset($orderableSubdefs[$databoxId][$recordId])) {
|
||||||
$orderableViews[$databoxId][$recordId] = [];
|
$orderableSubdefs[$databoxId][$recordId] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderableViews[$databoxId][$recordId][] = new SubdefViewModel($subdef, $link);
|
$orderableSubdefs[$databoxId][$recordId][] = $subdef;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($models as $model) {
|
foreach ($models as $model) {
|
||||||
@@ -332,8 +324,8 @@ class ApiOrderController extends BaseOrderController
|
|||||||
$databoxId = $collectionToDataboxMap[$element->getElement()->getBaseId()];
|
$databoxId = $collectionToDataboxMap[$element->getElement()->getBaseId()];
|
||||||
$recordId = $element->getElement()->getRecordId();
|
$recordId = $element->getElement()->getRecordId();
|
||||||
|
|
||||||
if (isset($orderableViews[$databoxId][$recordId])) {
|
if (isset($orderableSubdefs[$databoxId][$recordId])) {
|
||||||
$element->setOrderableMediaSubdefs($orderableViews[$databoxId][$recordId]);
|
$element->setOrderableMediaSubdefs($orderableSubdefs[$databoxId][$recordId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,11 +66,11 @@ class OrderElementViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SubdefViewModel[] $subdefs
|
* @param \media_subdef[] $subdefs
|
||||||
*/
|
*/
|
||||||
public function setOrderableMediaSubdefs($subdefs)
|
public function setOrderableMediaSubdefs($subdefs)
|
||||||
{
|
{
|
||||||
Assertion::allIsInstanceOf($subdefs, SubdefViewModel::class);
|
Assertion::allIsInstanceOf($subdefs, \media_subdef::class);
|
||||||
|
|
||||||
$this->subdefs = $subdefs instanceof \Traversable ? iterator_to_array($subdefs) : $subdefs;
|
$this->subdefs = $subdefs instanceof \Traversable ? iterator_to_array($subdefs) : $subdefs;
|
||||||
}
|
}
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2016 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Order;
|
|
||||||
|
|
||||||
class SubdefViewModel
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \media_subdef
|
|
||||||
*/
|
|
||||||
private $subdef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \media_Permalink_Adapter
|
|
||||||
*/
|
|
||||||
private $link;
|
|
||||||
|
|
||||||
public function __construct(\media_subdef $subdef, \media_Permalink_Adapter $link)
|
|
||||||
{
|
|
||||||
$this->subdef = $subdef;
|
|
||||||
$this->link = $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \media_subdef
|
|
||||||
*/
|
|
||||||
public function getSubdef()
|
|
||||||
{
|
|
||||||
return $this->subdef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \media_Permalink_Adapter
|
|
||||||
*/
|
|
||||||
public function getLink()
|
|
||||||
{
|
|
||||||
return $this->link;
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user