PHP code example of vf92 / bitrix-base

1. Go to this page and download the library: Download vf92/bitrix-base 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/ */

    

vf92 / bitrix-base example snippets


$logger = \Vf92\Log\LoggerFactory::create('название лога');

use \Vf92\Log\LazyLoggerAwareTrait

$this->withLogName('name');
$this->log() // это логгер

$logger = LoggerFactory::create('fullHrefDecorator');
$logger->critical('Системная ошибка при получении пукбличного пути ' . $e->getTraceAsString());

$dataManager = \Vf92\Constructor\EntityConstructor::compileEntityDataClass('Form', 'b_form');
//дальше работаем как обычно с объектом
$id = (int)$dataManager::query()->setSelect(['ID'])->setFilter(['SID' => $code])->exec()->fetch()['ID'];

$dataManager = \Vf92\Constructor\IblockPropEntityConstructor::getDataClass($iblockId);
$dataManager = \Vf92\Constructor\IblockPropMultipleEntityConstructor::getDataClass($iblockId);
//дальше работаем как обычно с объектом
$id = (int)$dataManager::query()->setSelect(['ID'])->setFilter(['CODE' => $code])->exec()->fetch()['ID'];

$fullPath = (new \Vf92\Decorators\FullHrefDecorator($path))->getFullPublicPath();