/** * See http://www.pimcore.org/issues/browse/PIMCORE-2358 * Add option to export/import all class definitions/brick definitions etc. at once */ public function bulkExportAction() { $result = []; $this->removeViewRenderer(); $fieldCollections = new Object\Fieldcollection\Definition\Listing(); $fieldCollections = $fieldCollections->load(); foreach ($fieldCollections as $fieldCollection) { $key = $fieldCollection->key; $fieldCollectionJson = json_decode(Object\ClassDefinition\Service::generateFieldCollectionJson($fieldCollection)); $fieldCollectionJson->key = $key; $result["fieldcollection"][] = $fieldCollectionJson; } $classes = new Object\ClassDefinition\Listing(); $classes->setOrder("ASC"); $classes->setOrderKey("id"); $classes = $classes->load(); foreach ($classes as $class) { $data = Model\Webservice\Data\Mapper::map($class, "\\Pimcore\\Model\\Webservice\\Data\\ClassDefinition\\Out", "out"); unset($data->fieldDefinitions); $result["class"][] = $data; } $objectBricks = new Object\Objectbrick\Definition\Listing(); $objectBricks = $objectBricks->load(); foreach ($objectBricks as $objectBrick) { $key = $objectBrick->key; $objectBrickJson = json_decode(Object\ClassDefinition\Service::generateObjectBrickJson($objectBrick)); $objectBrickJson->key = $key; $result["objectbrick"][] = $objectBrickJson; } $customLayouts = new Object\ClassDefinition\CustomLayout\Listing(); $customLayouts = $customLayouts->load(); foreach ($customLayouts as $customLayout) { /** @var $customLayout Object\ClassDefinition\CustomLayout */ $classId = $customLayout->getClassId(); $class = Object\ClassDefinition::getById($classId); $customLayout->className = $class->getName(); $result["customlayout"][] = $customLayout; } header("Content-type: application/json"); header("Content-Disposition: attachment; filename=\"bulk_export.json\""); $result = json_encode($result); echo $result; }