Здравствуйте!
Начинаю только изучать битрикс. Прошу помощи. Создал модуль. Модуль устанавливается и удаляется - с этим проблем нет. Но не создается таблица при установке, пишет: "Class 'Quest\Num\ResTable' not found (0)". Не могу понять в чем дело.
Файл установки index.php:
use \Bitrix\Main\Config as Conf;
use \Bitrix\Main\Config\Option;
use \Bitrix\Main\Loader;
use \Bitrix\Main\Entity\Base;
use \Bitrix\Main\Application;
Loc::loadMessages(__FILE__);
Class quest_num extends CModule
{
var $exclusionAdminFiles;
function __construct()
{
$arModuleVersion = array();
include(__DIR__."/version.php");
$this->exclusionAdminFiles=array(
'..',
'.',
'menu.php',
'operation_description.php',
'task_description.php'
);
$this->MODULE_ID = 'quest.num';
$this->MODULE_VERSION = $arModuleVersion["VERSION"];
$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
$this->MODULE_NAME = 'module name';
$this->MODULE_DESCRIPTION = 'decsription';
$this->PARTNER_NAME = 'partner';
$this->PARTNER_URI = 'uri';
$this->MODULE_SORT = 1;
$this->SHOW_SUPER_ADMIN_GROUP_RIGHTS='Y';
$this->MODULE_GROUP_RIGHTS = "Y";
}
function InstallDB()
{
Loader::includeModule($this->MODULE_ID);
Base::getInstance('\Quest\Num\ResTable')->createDbTable();
}
function UnInstallDB()
{
Loader::includeModule($this->MODULE_ID);
Application::getConnection(\Quest\Num\ResTable::getConnectionName())->
queryExecute('dr op table if exists '.Base::getInstance('\Quest\Num\ResTable')->getDBTableName());
Option::delete($this->MODULE_ID);
}
function DoInstall()
{
\Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID);
$this->InstallDB();
}
function DoUninstall()
{
Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID);
$this->UnInstallDB();
}
}
[/CODE]
Файл таблицы lib\res.php:
[CODE]<?namespace Quest\Num;
use \Bitrix\Main\Entity;
use \Bitrix\Main\Type;
class ResTable extends Entity\DataManager
{
public static function getTableName()
{
return 'res_news';
}
public static function getUfId()
{
return 'RES_NEWS';
}
public static function getMap()
{
return array(
new Entity\IntegerField('ID', array(
'primary' => true,
'autocomplete' => true,
)),
new Entity\StringField('NAME', array(
'required' => true,
)),
new Entity\StringField('AUTHOR'),
);
}
}
[/CODE]