Answer the question
In order to leave comments, you need to log in
How to use Iblock inside your class?
I needed to create my own class, I created it and connected it, I need to add an element through the method, I try to connect iblock and tried it through use and .
How do I create an instance of . Gives an error. \Bitrix\Main\Loader::includeModule( 'iblock' );
$el = new CIBlockElement();
Answer the question
In order to leave comments, you need to log in
use Bitrix\Iblock is not necessary and will not help, it is a namespace.
You also need to load the Iblock module, since the class you need in it, when the module is loaded, the autoloader of its classes is initialized.
use Bitrix\Main\Loader;
Loader::includeModule("iblock");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question