function schemas_execute()
{
    $params = func_get_arg(0);
    ConfigHandler::import('root.config');
    if (isset($params['config'])) {
        $conn = Manager::getConnection($params['config']);
    } else {
        throw new \Flywheel\Exception('missing "config" config key in user parameter');
    }
    $builder = new BuildSchemas($conn);
    $builder->_configKey = $params['config'];
    if (isset($params['help'])) {
        die($builder->get_help());
    }
    $builder->mod = isset($params['m']) ? $params['m'] : 'preserve';
    $builder->tbPrefix = isset($params['prefix']) ? $params['prefix'] : '';
    $builder->package = isset($params['pack']) ? $params['pack'] : '';
    if (isset($params['table'])) {
        $builder->setSpecialTbl($params['table']);
    }
    if (isset($params['igtbl'])) {
        $builder->setIgnoreTables($params['igtbl']);
    }
    if (isset($params['igprefix'])) {
        $builder->setIgnoreTablePrefixes($params['igprefix']);
    }
    if (isset($params['allow_tbl'])) {
        $builder->setAllowTables($params['allow_tbl']);
    }
    if (isset($params['allow_prefix'])) {
        $builder->setAllowTablePrefixes($params['allow_prefix']);
    }
    $builder->run();
}
Example #2
0
 /**
  * delete object model
  * @return boolean
  * @throws \Exception
  */
 public function delete()
 {
     $conn = Manager::getConnection(self::getDbConnectName());
     $conn->beginTransaction();
     try {
         $this->_beforeDelete();
         $this->deleteFromDb();
         $this->_afterDelete();
         $conn->commit();
         self::removeInstanceFromPool($this->getPkValue());
         return true;
     } catch (\Exception $e) {
         $conn->rollBack();
         throw $e;
     }
 }
 /**
  * get read database connection (slave)
  * @return \Flywheel\Db\Connection
  */
 public static function getReadConnection()
 {
     return Manager::getConnection(self::getDbConnectName(), self::getReadMode());
 }
 public function getAdapter()
 {
     return Manager::getAdapter($this->getAttribute(self::ATTR_CONNECTION_NAME));
 }