public function prepareExportFileVariables() : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => []
		];
		// details
		$details = [];
		if (!empty($this->collection['details'])) {
			$this->disassembleCollectionObject($this->collection['details'], $details);
		}
		// step 1: fields
		$result['data'][$this->collection['name']] = [];
		foreach ($this->fields as $k => $v) {
			if (!$this->skipExportField($k, $v)) continue;
			// if we have detail
			if (!empty($details[$k])) {
				$result['data'][$details[$k]['name']] = [];
				foreach ($details[$k]['pk'] as $k2 => $v2) {
					if ($k2 == 0 && strpos($v2, 'tenant_id') !== false) continue;
					$result['data'][$details[$k]['name']][0][$v2] = $v2;
				}
				continue;
			}
			// regular field
			$result['data'][$this->collection['name']][0][$k] = $k;
		}
		// step 2: detail fields
		foreach ($this->detail_fields as $k => $v) {
			$result['data'][$details[$k]['name']] = [];
			// add pk
			foreach ($details[$k]['pk'] as $k2 => $v2) {
				if ($k2 == 0 && strpos($v2, 'tenant_id') !== false) continue;
				$result['data'][$details[$k]['name']][0][$v2] = $v2;
			}
			// add fields
			foreach ($v['elements'] as $k2 => $v2) {
				if (!$this->skipExportField($k2, $v2)) continue;
				$result['data'][$details[$k]['name']][0][$k2] = $k2;
			}
		}
		$result['success'] = true;
		return $result;
	}
public function prepareExportFileVariables() : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => []
		];
		// details
		$details = [];
		if (!empty($this->collection['details'])) {
			$this->disassembleCollectionObject($this->collection['details'], $details);
		}
		// step 1: fields
		$result['data'][$this->collection['name']] = [];
		foreach ($this->fields as $k => $v) {
			if (!$this->skipExportField($k, $v)) continue;
			// if we have detail
			if (!empty($details[$k])) {
				$result['data'][$details[$k]['name']] = [];
				foreach ($details[$k]['pk'] as $k2 => $v2) {
					if ($k2 == 0 && strpos($v2, 'tenant_id') !== false) continue;
					$result['data'][$details[$k]['name']][0][$v2] = $v2;
				}
				continue;
			}
			// regular field
			$result['data'][$this->collection['name']][0][$k] = $k;
		}
		// step 2: detail fields
		foreach ($this->detail_fields as $k => $v) {
			$result['data'][$details[$k]['name']] = [];
			// add pk
			foreach ($details[$k]['pk'] as $k2 => $v2) {
				if ($k2 == 0 && strpos($v2, 'tenant_id') !== false) continue;
				$result['data'][$details[$k]['name']][0][$v2] = $v2;
			}
			// add fields
			foreach ($v['elements'] as $k2 => $v2) {
				if (!$this->skipExportField($k2, $v2)) continue;
				$result['data'][$details[$k]['name']][0][$k2] = $k2;
			}
		}
		$result['success'] = true;
		return $result;
	}
public function prepareExportFileVariables ( ) : array { $ result = [ 'success' => false , 'error' => [ ] , 'data' => [ ] ] ; // details $ details = [ ] ; if ( ! empty ( $ this -> collection [ 'details' ] ) ) { $ this -> disassembleCollectionObject ( $ this -> collection [ 'details' ] , $ details ) ; } // step 1: fields $ result [ 'data' ] [ $ this -> collection [ 'name' ] ] = [ ] ; foreach ( $ this -> fields as $ k => $ v ) { if ( ! $ this -> skipExportField ( $ k , $ v ) ) continue ; // if we have detail if ( ! empty ( $ details [ $ k ] ) ) { $ result [ 'data' ] [ $ details [ $ k ] [ 'name' ] ] = [ ] ; foreach ( $ details [ $ k ] [ 'pk' ] as $ k2 => $ v2 ) { if ( $ k2 == 0 && strpos ( $ v2 , 'tenant_id' ) !== false ) continue ; $ result [ 'data' ] [ $ details [ $ k ] [ 'name' ] ] [ 0 ] [ $ v2 ] = $ v2 ; } continue ; } // regular field $ result [ 'data' ] [ $ this -> collection [ 'name' ] ] [ 0 ] [ $ k ] = $ k ; } // step 2: detail fields foreach ( $ this -> detail_fields as $ k => $ v ) { $ result [ 'data' ] [ $ details [ $ k ] [ 'name' ] ] = [ ] ; // add pk foreach ( $ details [ $ k ] [ 'pk' ] as $ k2 => $ v2 ) { if ( $ k2 == 0 && strpos ( $ v2 , 'tenant_id' ) !== false ) continue ; $ result [ 'data' ] [ $ details [ $ k ] [ 'name' ] ] [ 0 ] [ $ v2 ] = $ v2 ; } // add fields foreach ( $ v [ 'elements' ] as $ k2 => $ v2 ) { if ( ! $ this -> skipExportField ( $ k2 , $ v2 ) ) continue ; $ result [ 'data' ] [ $ details [ $ k ] [ 'name' ] ] [ 0 ] [ $ k2 ] = $ k2 ; } } $ result [ 'success' ] = true ; return $ result ; }
Prepare export file variables

@return array
Prepare export file variables