Answer the question
In order to leave comments, you need to log in
How to create a table via ORM in an additional database connected to Bitrix?
Hello!
It was necessary to connect an additional database to Bitrix.
To create a table in an additional database, I wanted to use the Bitrix\Main\Entity\Base class:
use Bitrix\Main\Application;
use Ramapriya\ORM;
use Bitrix\Main\Entity\Base;
$dbApps = Application::getConnection('apps');
$base = Base::getInstance(ORM\ApplicationTable::class);
$tableName = $base->getDBTableName();
if(!$dbApps->isTableExists($tableName)) {
$base->createDbTable($tableName);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question