示例#1
0
 public final function __construct(IConfig $config)
 {
     if (null === $config || !$config->isReadSuccess()) {
         throw new Err('', Err::E_CFG_INCORRECT);
     }
     $this->config = $config;
     //$this->class = new PhpClass($this->config->getNamespace().'\\'.$this->config->getClass());
     $this->phpClass = new PhpClass($this->config->getClass());
     $this->phpClass->setNamespace($this->config->getNamespace());
     $this->phpClass->useLangFile();
     $this->phpClass->setLangPrefix($this->config->getLangPrefix());
     $this->__init($config);
 }
示例#2
0
 public function saveEntityClass($path = null)
 {
     if (empty($path)) {
         $path = $this->config->getClassPath();
     }
     Tools::_fixFilePath($path);
     if ('/' != substr($path, 0, 1)) {
         $path = '/bitrix/modules/' . $this->config->getModuleID() . '/' . $path;
     }
     if (!CheckDirPath(OBX_DOC_ROOT . $path)) {
         throw new Err('', Err::E_CLASS_SAVE_FAILED);
     }
     if (false === file_put_contents(OBX_DOC_ROOT . $path, $this->phpClass->generateClass())) {
         return false;
     }
     return true;
 }