mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 22:13:13 +00:00
Slight refactor of set_export to avoid N+1
This commit is contained in:
@@ -68,8 +68,6 @@ class record_exportElement extends record_adapter
|
||||
parent::__construct($app, $sbas_id, $record_id);
|
||||
|
||||
$this->get_actions($remain_hd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,8 +268,7 @@ class record_exportElement extends record_adapter
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Array
|
||||
* @return array
|
||||
*/
|
||||
public function get_orderable()
|
||||
{
|
||||
@@ -279,8 +276,7 @@ class record_exportElement extends record_adapter
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Array
|
||||
* @return array
|
||||
*/
|
||||
public function get_downloadable()
|
||||
{
|
||||
|
@@ -99,19 +99,20 @@ class set_export extends set_abstract
|
||||
} else {
|
||||
$this->exportName = "Export_" . date("Y-n-d") . '_' . mt_rand(100, 999);
|
||||
|
||||
$tmp_lst = explode(';', $lst);
|
||||
$n = 1;
|
||||
foreach ($tmp_lst as $basrec) {
|
||||
$basrec = explode('_', $basrec);
|
||||
if (count($basrec) != 2)
|
||||
continue;
|
||||
|
||||
$records = new \Alchemy\Phrasea\Record\RecordReferenceCollection();
|
||||
|
||||
foreach (explode(';', $lst) as $basrec) {
|
||||
try {
|
||||
$record = new record_adapter($this->app, $basrec[0], $basrec[1]);
|
||||
} catch (\Exception_Record_AdapterNotFound $e) {
|
||||
$records[] = \Alchemy\Phrasea\Record\RecordReference::createFromRecordReference($basrec);
|
||||
} catch (Exception $exception) {
|
||||
// Ignore invalid record references
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($records->toRecords($app->getApplicationBox()) as $record) {
|
||||
if ($record->isStory()) {
|
||||
foreach ($record->getChildren() as $child_basrec) {
|
||||
$base_id = $child_basrec->getBaseId();
|
||||
|
Reference in New Issue
Block a user