PHP code example of kharanenka / oc-data-file-model
1. Go to this page and download the library: Download kharanenka/oc-data-file-model 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/ */
kharanenka / oc-data-file-model example snippets
class MyModel extends Model
{
use DataFileModel;
public $attachOne = ['preview_image' => 'System\Models\File'];
public $attachMany = ['images' => 'System\Models\File'];
}
$obModel = MyModel::first();
$arFileData = $obModel->getFileData('preview_image');
$arFileList = $obModel->getFileListData('images');