예제 #1
0
 protected function import($xml, $tools)
 {
     if (isset($xml['import'])) {
         $import = (string) $xml['import'];
         jApp::pushCurrentModule($this->selector->module);
         // Keep the same driver as current used
         $importSel = new jSelectorDaoDb($import, $this->selector->driver, $this->selector->dbType);
         jApp::popCurrentModule();
         $doc = new DOMDocument();
         if (!$doc->load($importSel->getPath())) {
             throw new jException('jelix~daoxml.file.unknown', $importSel->getPath());
         }
         $parser = new jDaoParser($importSel);
         $parser->parse(simplexml_import_dom($doc), $tools);
         $this->_properties = $parser->getProperties();
         $this->_tables = $parser->getTables();
         $this->_primaryTable = $parser->getPrimaryTable();
         $this->_methods = $parser->getMethods();
         $this->_ojoins = $parser->getOuterJoins();
         $this->_ijoins = $parser->getInnerJoins();
         $this->_eventList = $parser->getEvents();
         $this->_userRecord = $parser->getUserRecord();
         $this->_importedDao = $parser->getImportedDao();
         $this->hasOnlyPrimaryKeys = $parser->hasOnlyPrimaryKeys;
         if ($this->_importedDao) {
             $this->_importedDao[] = $importSel;
         } else {
             $this->_importedDao = array($importSel);
         }
     }
 }