PHP code example of arrilot / bitrix-collectors
1. Go to this page and download the library: Download arrilot/bitrix-collectors library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
arrilot / bitrix-collectors example snippets
use Arrilot\BitrixCollectors\FileCollector;
$items = [
['ID' => 1, 'PROPERTY_FILES1_VALUE' => 1],
['ID' => 2, 'PROPERTY_FILES2_VALUE' => [2, 1]],
];
$item = ['ID' => 3, 'PROPERTY_OTHER_FILES_VALUE' => 4];
$collector = new FileCollector();
$files = $collector->scanCollection($items, ['PROPERTY_FILES1_VALUE', 'PROPERTY_FILES2_VALUE'])
->scanItem($item, 'PROPERTY_OTHER_FILES_VALUE')
->performQuery();
var_dump($files);
// результат
/*
array:3 [▼
1 => array:13 [▼
"ID" => "1"
"TIMESTAMP_X" => "2017-02-10 17:25:17"
"MODULE_ID" => "iblock"
"HEIGHT" => "150"
"WIDTH" => "140"
"FILE_SIZE" => "15003"
"CONTENT_TYPE" => "image/png"
"SUBDIR" => "iblock/b03"
"FILE_NAME" => "avatar.png"
"ORIGINAL_NAME" => "avatar-gs.png"
"DESCRIPTION" => ""
"HANDLER_ID" => null
"EXTERNAL_ID" => "125dc3213f7ecde31124f3ebca7322b5"
],
2 => array:13 [▼
"ID" => "2"
"TIMESTAMP_X" => "2017-02-10 17:31:30"
"MODULE_ID" => "iblock"
"HEIGHT" => "84"
"WIDTH" => "460"
"FILE_SIZE" => "4564"
"CONTENT_TYPE" => "image/png"
"SUBDIR" => "iblock/fcf"
"FILE_NAME" => "4881-03.png"
"ORIGINAL_NAME" => "4881-03.png"
"DESCRIPTION" => ""
"HANDLER_ID" => null
"EXTERNAL_ID" => "35906df62694b4ed5f150c468a1f5d72"
]
4 => array:13 [▼
"ID" => "4"
"TIMESTAMP_X" => "2017-02-10 17:33:30"
"MODULE_ID" => "iblock"
"HEIGHT" => "84"
"WIDTH" => "460"
"FILE_SIZE" => "4564"
"CONTENT_TYPE" => "image/png"
"SUBDIR" => "iblock/fc2"
"FILE_NAME" => "test.png"
"ORIGINAL_NAME" => "4881-03.png"
"DESCRIPTION" => ""
"HANDLER_ID" => null
"EXTERNAL_ID" => "35906df62694b4ed5f150c468a1f5d53"
]
]
*/