Example #1
0
 public function terminate()
 {/*{{{*/
     BeanFinder::destroy('configs');
     BeanFinder::destroy('dbexecuter');
     BeanFinder::destroy('idgenter');
     BeanFinder::destroy('debug');
 }/*}}}*/
Example #2
0
 public final function commit($restart = false)
 {
     if ($this->isCommited()) {
         throw new SystemException('UnitOfWork is commited, can not commit again.');
     }
     if ($this->isReadOnly() == false) {
         $this->findModifiedEntities();
         $statements = array();
         $this->buildSqlStatement('getInsertCommand', $this->insertList, $statements);
         $this->buildSqlStatement('getUpdateCommand', $this->updateList, $statements);
         $this->buildSqlStatement('getDeleteCommand', $this->deleteList, $statements);
         $this->doCommit($statements);
         $this->cleanCache();
         $this->dealSearchIndex();
     }
     if ($restart) {
         $this->insertList = array();
         $this->updateList = array();
         $this->deleteList = array();
         $this->searchRelatedList = array();
         BeanFinder::register('LocalCache', new LocalCache());
     } else {
         BeanFinder::destroy('UnitOfWork');
     }
 }