mirror of
https://github.com/espocrm/espocrm.git
synced 2026-07-01 08:26:04 +00:00
export: use additional applier
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Tools\Export;
|
||||
|
||||
use Espo\Core\ORM\Repository\Option\SaveOption;
|
||||
use Espo\Core\Record\Select\ApplierClassNameListProvider;
|
||||
use Espo\Tools\Export\Collection as ExportCollection;
|
||||
use Espo\Tools\Export\Processor\Params as ProcessorParams;
|
||||
use Espo\ORM\Entity;
|
||||
@@ -72,7 +73,8 @@ class Export
|
||||
private FileStorageManager $fileStorageManager,
|
||||
private ListLoadProcessor $listLoadProcessor,
|
||||
private FieldUtil $fieldUtil,
|
||||
private User $user
|
||||
private User $user,
|
||||
private ApplierClassNameListProvider $applierClassNameListProvider
|
||||
) {}
|
||||
|
||||
public function setParams(Params $params): self
|
||||
@@ -174,7 +176,7 @@ class Export
|
||||
|
||||
$fileName = $fileName ?
|
||||
$fileName . '.' . $fileExtension :
|
||||
"Export_{$entityType}.{$fileExtension}";
|
||||
"Export_$entityType.$fileExtension";
|
||||
|
||||
$processorParams = (new ProcessorParams($fileName, $attributeList, $fieldList))
|
||||
->withName($params->getName())
|
||||
@@ -291,6 +293,9 @@ class Export
|
||||
->create()
|
||||
->forUser($this->user)
|
||||
->from($entityType)
|
||||
->withAdditionalApplierClassNameList(
|
||||
$this->applierClassNameListProvider->get($entityType)
|
||||
)
|
||||
->withSearchParams($searchParams);
|
||||
|
||||
if ($params->applyAccessControl()) {
|
||||
|
||||
@@ -146,6 +146,7 @@ class Params
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
public function withFileName(?string $fileName): self
|
||||
{
|
||||
$obj = clone $this;
|
||||
@@ -213,11 +214,17 @@ class Params
|
||||
*/
|
||||
public function getSearchParams(): SearchParams
|
||||
{
|
||||
if (!$this->searchParams) {
|
||||
return SearchParams::create();
|
||||
$searchParams = $this->searchParams ?? SearchParams::create();
|
||||
|
||||
if ($searchParams->getSelect() !== null) {
|
||||
return $searchParams;
|
||||
}
|
||||
|
||||
return $this->searchParams;
|
||||
if ($this->getAttributeList()) {
|
||||
$searchParams = $searchParams->withSelect($this->getAttributeList());
|
||||
}
|
||||
|
||||
return $searchParams;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user