Skip to content

Commit

Permalink
Merge pull request #17 from DivanteLtd/bugfix/export-selected
Browse files Browse the repository at this point in the history
Exporting selected items
  • Loading branch information
t-zilla authored Sep 23, 2020
2 parents a65e614 + 0ddc845 commit 38236b4
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/AdvancedSearchBundle/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,30 @@ public function getExportJobsAction(Request $request, Service $service)
$request->setLocale($request->get('language'));
}

$data = json_decode($request->get('filter'), true);
$ids = $request->get('ids');

$class = DataObject\ClassDefinition::getById($data['classId']);
$className = $class->getName();
if (!$ids) {
$data = json_decode($request->get('filter'), true);

$listClass = '\\Pimcore\\Model\\DataObject\\' . ucfirst($className) . '\\Listing';
$class = DataObject\ClassDefinition::getById($data['classId']);
$className = $class->getName();

/**
* @var $list Listing
*/
$list = new $listClass();
$list->setObjectTypes(['object', 'folder', 'variant']);
$listClass = '\\Pimcore\\Model\\DataObject\\' . ucfirst($className) . '\\Listing';

$results = $service->doFilter(
$list,
$data['conditions']
);
/**
* @var $list Listing
*/
$list = new $listClass();
$list->setObjectTypes(['object', 'folder', 'variant']);

$results = $service->doFilter(
$list,
$data['conditions']
);

$ids = $results->loadIdList();
}

$ids = $results->loadIdList();
$jobs = array_chunk($ids, 20);

$fileHandle = uniqid('export-');
Expand Down

0 comments on commit 38236b4

Please sign in to comment.