예제 #1
0
 /**
  * Creates the table.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->string('username')->unique();
     $table->string('password');
     $table->timestamps();
 }
 public function checkIn(Blueprint $blueprint)
 {
     $tag = "BlueprintLibrary: checkIn()";
     Log::debug("{$tag} <" . $blueprint->signature() . ">");
     $signature = $blueprint->signature();
     $this->library["{$signature}"] = $blueprint;
 }
예제 #3
0
 public function testCreate()
 {
     $name = 'testuser';
     //create Phactory\Sql\Blueprint object and a new Phactory_Row object
     $phactory_blueprint = new Blueprint('user', ['name' => $name], [], $this->phactory);
     $phactory_row = $phactory_blueprint->create();
     //test $phactory_row is of type Phactory\Sql\Row and that object stored name correctly
     $this->assertInstanceOf('Phactory\\Sql\\Row', $phactory_row);
     $this->assertEquals($phactory_row->name, $name);
 }
예제 #4
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->integer('map_id')->unsigned();
     $table->foreign('map_id')->references('id')->on('maps')->onDelete('cascade');
     $table->string('type')->default('normal');
     $table->integer('team_a_side_1')->default(0);
     $table->integer('team_a_side_2')->default(0);
     $table->integer('team_b_side_1')->default(0);
     $table->integer('team_b_side_2')->default(0);
     $table->timestamps();
 }
예제 #5
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->string('name');
     $table->string('config_file')->default('esl5on5');
     $table->integer('max_rounds')->default(15);
     $table->boolean('knife_round')->default(true);
     $table->boolean('overtime_enabled')->default(true);
     $table->bigInteger('overtime_start_money')->default(10000);
     $table->integer('overtime_max_round')->default(3);
     $table->timestamps();
 }
 public function trackStackDependency($type, $stack, $resource, Blueprint $sourceBlueprint = null, $sourceType = null, $sourceKey = null)
 {
     if (!isset($this->stacks[$type])) {
         $this->stacks[$type] = [];
     }
     if (!isset($this->stacks[$type][$stack])) {
         $this->stacks[$type][$stack] = [];
     }
     if (!isset($this->stacks[$type][$stack][$resource])) {
         $this->stacks[$type][$stack][$resource] = [];
     }
     $this->stacks[$type][$stack][$resource][] = ['type' => $sourceType ? $sourceType : '', 'blueprint' => $sourceBlueprint ? $sourceBlueprint->getName() : '', 'key' => $sourceKey ? $sourceKey : ''];
 }
예제 #7
0
 /**
  * @dataProvider dataProvider
  */
 public function testLoad($test)
 {
     $blueprint = new Blueprint($test);
     $blueprint->setOverrides(['extends' => ['extends', 'basic']]);
     $blueprint->load();
     // Save test results if they do not exist (data needs to be verified by human!)
     /*
     $resultFile = YamlFile::instance(__DIR__ . '/data/form/items/' . $test . '.yaml');
     if (!$resultFile->exists()) {
         $resultFile->content($blueprint->toArray());
         $resultFile->save();
     }
     */
     // Test 1: Loaded form.
     $this->assertEquals($this->loadYaml($test, 'form/items'), $blueprint->toArray());
 }
예제 #8
0
 /**
  * Constructor. Use \iveeCore\Type::getById() to instantiate InventorBlueprint objects instead.
  * 
  * @param int $id of the InventorBlueprint object
  * 
  * @return \iveeCore\InventorBlueprint
  * @throws \iveeCore\Exceptions\TypeIdNotFoundException if typeID is not found
  */
 protected function __construct($id)
 {
     parent::__construct($id);
     $sdeClass = Config::getIveeClassName('SDE');
     $sde = $sdeClass::instance();
     //query for inventable blueprints, probability and decryptorGroupID
     $res = $sde->query("SELECT iap.productTypeID, iap.probability, COALESCE(valueInt, valueFloat) as decryptorGroupID\n            FROM dgmTypeAttributes as dta\n            JOIN industryActivityMaterials as iam ON iam.materialTypeID = dta.typeID\n            JOIN industryActivityProbabilities as iap ON iap.typeID = iam.typeID\n            WHERE attributeID = 1115\n            AND iam.activityID = 8\n            AND iap.activityID = 8\n            AND iam.typeID = " . $this->id . ';');
     if ($res->num_rows < 1) {
         self::throwException('TypeIdNotFoundException', "Inventor data for blueprintID=" . $this->id . " not found");
     }
     while ($row = $res->fetch_assoc()) {
         $this->inventsBlueprintIDs[(int) $row['productTypeID']] = 1;
         $this->inventionProbability = (double) $row['probability'];
         $this->decryptorGroupID = (int) $row['decryptorGroupID'];
     }
     //get the mapping for skills to datacore or interface
     $res = $sde->query("SELECT COALESCE(valueInt, valueFloat) as skillID, it.groupID\n            FROM dgmTypeAttributes as dta\n            JOIN invTypes as it ON it.typeID = dta.typeID\n            WHERE dta.attributeID = 182\n            AND groupID IN (333, 716)\n            AND COALESCE(valueInt, valueFloat) IN (" . implode(', ', array_keys($this->getSkillMapForActivity(ProcessData::ACTIVITY_INVENTING)->getSkills())) . ");");
     $this->datacoreSkillIDs = array();
     while ($row = $res->fetch_assoc()) {
         if ($row['groupID'] == 333) {
             $this->datacoreSkillIDs[] = $row['skillID'];
         } elseif ($row['groupID'] == 716) {
             $this->encryptionSkillID = $row['skillID'];
         }
     }
 }
 /**
  * Sets attributes from SQL result row to object
  * 
  * @param array $row data from DB
  * 
  * @return void
  */
 protected function setAttributes(array $row)
 {
     parent::setAttributes($row);
     if (isset($row['t1BpID'])) {
         $this->inventedFromBlueprintID = (int) $row['t1BpID'];
     }
 }
예제 #10
0
 /**
  * Constructor. Use iveeCore\Type::getById() to instantiate InventorBlueprint objects instead.
  *
  * @param int $id of the InventorBlueprint object
  *
  * @throws \iveeCore\Exceptions\TypeIdNotFoundException if typeId is not found
  */
 protected function __construct($id)
 {
     parent::__construct($id);
     $sdeClass = Config::getIveeClassName('SDE');
     $sde = $sdeClass::instance();
     $this->loadInventionStats($sde);
     $this->loadSkillToDatacoreInterface($sde);
 }
예제 #11
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->integer('map_id')->unsigned();
     $table->foreign('map_id')->references('id')->on('maps')->onDelete('cascade');
     $table->integer('current_round');
     $table->string('type');
     $table->json('data');
     $table->timestamps();
 }
예제 #12
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->string('name');
     $table->string('ip');
     $table->integer('port')->default(27015);
     $table->string('gotv_ip');
     $table->string('rcon');
     $table->timestamps();
 }
예제 #13
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->string('name');
     $table->string('subtitle')->nullable();
     $table->boolean('active')->default(false);
     $table->string('link')->nullable();
     $table->longText('description')->nullable();
     $table->timestamps();
 }
예제 #14
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->integer('event_id')->unsigned();
     $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade');
     $table->string('name');
     $table->string('flag');
     $table->string('logo')->nullable();
     $table->timestamps();
 }
예제 #15
0
 /**
  * @depends testGetOtherModel
  */
 public function testSetOtherModel()
 {
     $m1 = Blueprint::make('Model1');
     $m2 = Blueprint::make('Model2');
     $m1->Model2 = $m2;
     $this->assertEquals($m2->id, $m1->model2_id);
     $this->assertEquals($m2, $m1->Model2());
     $m1->commit();
 }
예제 #16
0
 public function testDefaultOrder()
 {
     $key = "ordertest";
     $m1 = Blueprint::make('Model1', ['int1' => 1, 'str1' => $key]);
     $m2 = Blueprint::make('Model1', ['int1' => 2, 'str1' => $key]);
     Model1Ordered::$order = "int1";
     $selection = Model1Ordered::selection(['str1' => $key]);
     $this->assertEquals($m1->id, $selection[0]->id);
     $this->assertEquals($m2->id, $selection[1]->id);
     Model1Ordered::$order = "int1:desc";
     $selection = Model1Ordered::selection(['str1' => $key]);
     $this->assertEquals($m2->id, $selection[0]->id);
     $this->assertEquals($m1->id, $selection[1]->id);
 }
 public static function write(Blueprint $blueprint)
 {
     $tag = "BlueprintWriter: write()";
     Log::debug("{$tag}");
     $xml = $blueprint->asXml();
     $blueprint_file_name = $blueprint->signature();
     $blueprint_file_path = BPConfig::$path_blueprints . $blueprint_file_name;
     if (is_writable(BPConfig::$path_blueprints)) {
         if ($file = fopen($blueprint_file_path, "w")) {
             if ($bytes = fwrite($file, $xml)) {
                 Log::debug("{$tag}: {$bytes} bytes written to {$file}");
                 return $xml;
             } else {
                 throw new Exception("Unable to write to file");
             }
             fclose($file);
         } else {
             throw new Exception("Unable to open file for writing");
         }
     } else {
         throw new Exception("Target directory is not writable");
     }
 }
예제 #18
0
 /**
  * Sets all the incremental columns in a table.
  *
  * @param $table_columns
  */
 public function SetIncremental($table_columns)
 {
     /**
      * You can set a primary instance by putting a '*' at the end of the column name
      */
     foreach ($table_columns as $key => $value) {
         /**
          * Great, we found a primary!
          */
         if (String::GetLast($key) == '~') {
             /**
              * Returns the full string minus the last character.
              */
             $value = String::RemoveLast($key);
             /**
              * Now lets set this as a primary!
              */
             $this->blueprint->increments($value);
         }
     }
 }
예제 #19
0
 /**
  * Constructor. Use \iveeCore\Type::getById() to instantiate REBlueprint objects instead.
  *
  * @param int $id of the REBlueprint object
  *
  * @return \iveeCore\REBlueprint
  * @throws \iveeCore\Exceptions\TypeIdNotFoundException if the typeID is not found
  */
 protected function __construct($id)
 {
     //call parent constructor
     parent::__construct($id);
     $sdeClass = Config::getIveeClassName('SDE');
     $sde = $sdeClass::instance();
     //get Relics this REBlueprint can be reverse-engineered from
     $res = $sde->query("SELECT typeID\n            FROM industryActivityProducts\n            WHERE activityID = 7\n            AND productTypeID = " . $this->id . ';');
     if ($res->num_rows < 1) {
         self::throwException('TypeIdNotFoundException', "Reverse Engineering data for REBlueprint ID=" . $this->id . " not found");
     }
     while ($row = $res->fetch_assoc()) {
         $this->reverseEngineeredFromRelicIDs[] = (int) $row['typeID'];
     }
     //get the raceID of the product
     $res = $sde->query("SELECT raceID\n            FROM invTypes\n            WHERE typeID = " . $this->productId . ';');
     if ($res->num_rows < 1) {
         self::throwException('TypeIdNotFoundException', "Reverse Engineering data for REBlueprint ID=" . $this->id . " not found");
     }
     //lookup decryptor based on race
     while ($row = $res->fetch_assoc()) {
         $this->reverseEngineeringDecryptorID = static::$raceDecryptor[(int) $row['raceID']];
     }
 }
예제 #20
0
 /**
  * create sql string
  *
  * @return string
  */
 public function fetch()
 {
     $content = isset($this->table) ? sprintf($this->patterns['create'], $this->table) : '';
     foreach (Blueprint::getCommand() as $command) {
         $content .= $command->rende();
     }
     $content = rtrim($content, ',');
     $content .= sprintf($this->patterns['end'], $this->charset);
     return $content;
 }
예제 #21
0
Blueprint::make('Marketplace', function ($blueprint) {
    $blueprint->setController(MarketplaceController::class);
    $blueprint->disablePluralForm();
    $blueprint->setIcon('cloud');
    $blueprint->setToolbarOrders(['section' => ['getHome.search', 'postInstall', 'getInstallProgress', 'getInstalled'], 'item' => ['getDetails', 'postRequire'], 'provider' => ['postToggleProvider']]);
    $blueprint->makeAction(['name' => 'getHome', 'pattern' => '/']);
    $blueprint->makeToolbarItem(['action' => 'getHome', 'label' => 'Marketplace', 'icon' => 'shopping-cart']);
    $blueprint->makeToolbarItem(['action' => 'getHome', 'identifier' => 'getHome.search', 'fields' => function () {
        $query = new FieldMetadata('q', 'search', true);
        $query->label = 'Query';
        $query->placeholder = 'Search for Packages';
        $query->attributes['results'] = 5;
        return [$query];
    }], new FormToolbarItemFactory());
    $blueprint->makeAction(['name' => 'postInstall', 'pattern' => 'install', 'method' => 'POST']);
    $blueprint->makeToolbarItem(['action' => 'postInstall', 'label' => 'Run Installer', 'icon' => 'download', 'color' => 'green', 'dialog' => new Dialog(Lang::get('oxygen/mod-marketplace::dialogs.runInstaller')), 'shouldRenderCallback' => function (ActionToolbarItem $item, array $arguments) {
        return $item->shouldRenderBasic($arguments) && !Marketplace::getInstaller()->isInstalling();
    }]);
    $blueprint->makeAction(['name' => 'getInstallProgress', 'pattern' => 'install/progress']);
    $blueprint->makeToolbarItem(['action' => 'getInstallProgress', 'label' => 'Install Progress', 'icon' => 'info-circle', 'color' => 'white', 'shouldRenderCallback' => function (ActionToolbarItem $item, array $arguments) {
        return $item->shouldRenderBasic($arguments) && Marketplace::getInstaller()->isInstalling();
    }]);
    $blueprint->makeAction(['name' => 'deleteInstallProgress', 'pattern' => 'install/progress', 'method' => 'DELETE']);
    $blueprint->makeToolbarItem(['action' => 'deleteInstallProgress', 'label' => 'Clear Install Log', 'icon' => 'trash-o', 'color' => 'red', 'shouldRenderCallback' => function ($item, $arguments) {
        return $item->shouldRenderBasic($arguments) && Marketplace::getInstaller()->hasInstallProgress();
    }]);
    $blueprint->makeAction(['name' => 'postInstallProgress', 'pattern' => 'install/progress', 'method' => 'POST']);
    $blueprint->makeAction(['name' => 'getDetails', 'pattern' => '{vendor}/{package}', 'routeParametersCallback' => function ($action, array $options) {
        return [$options['vendor'], $options['package']];
    }]);
    $blueprint->makeToolbarItem(['action' => 'getDetails', 'label' => 'Show Details', 'icon' => 'info-circle']);
    $blueprint->makeAction(['name' => 'postRequire', 'pattern' => '{vendor}/{package}/require/{version?}', 'method' => 'POST', 'routeParametersCallback' => function ($action, array $options) {
        return [$options['vendor'], $options['package']];
    }]);
    $blueprint->makeToolbarItem(['action' => 'postRequire', 'label' => 'Require', 'icon' => 'plus', 'color' => 'green'])->addDynamicCallback(function ($item, $arguments) {
        $installer = Marketplace::getInstaller();
        $package = $arguments['vendor'] . '/' . $arguments['package'];
        if ($installer->isRequired($package)) {
            $item->color = 'red';
            $item->icon = 'trash-o';
            $item->label = 'Remove';
        }
    });
    $blueprint->makeAction(['name' => 'getInstalled', 'pattern' => 'installed']);
    $blueprint->makeToolbarItem(['action' => 'getInstalled', 'label' => 'Installed Packages', 'icon' => 'list', 'color' => 'white']);
    $blueprint->makeAction(['name' => 'postToggleProvider', 'pattern' => 'provider/toggle/{class}', 'method' => 'POST', 'routeParametersCallback' => function ($action, array $options) {
        return [$options['provider']];
    }]);
    $blueprint->makeToolbarItem(['action' => 'postToggleProvider', 'label' => 'Enable', 'icon' => 'check', 'color' => 'white', 'shouldRenderCallback' => function (ActionToolbarItem $item, array $arguments) {
        return $item->shouldRenderBasic($arguments) && !Marketplace::getProviderRepository()->isCore($arguments['provider']);
    }])->addDynamicCallback(function ($item, $arguments) {
        $repository = Marketplace::getProviderRepository();
        if ($repository->isEnabled($arguments['provider'])) {
            $item->icon = 'power-off';
            $item->label = 'Disable';
        }
    });
});
예제 #22
0
 private function create($set, $name, $commit)
 {
     if (!isset($this->data[$name])) {
         throw new BlueprintException("Unknow blueprint '{$name}' for {$this->class_name}");
     }
     $data = array_merge($this->data[$name], $set);
     $attr = array('sn' => Blueprint::$sn++);
     $class_name = $this->class_name;
     $obj = new $class_name();
     foreach ($data as $key => $value) {
         if (is_string($value)) {
             $obj->{$key} = preg_replace_callback("/#\\{(.+?)\\}/", function ($matches) use($attr, $data) {
                 $k = $matches[1];
                 $replace = false;
                 if (isset($attr[$k])) {
                     $replace = $attr[$k];
                 } else {
                     $replace = $obj->{$k};
                 }
                 return $replace;
             }, $value);
         } else {
             if (is_array($value)) {
                 $blueprint = "default";
                 $class = $key;
                 $values = array();
                 if (isset($value['blueprint'])) {
                     $blueprint = $value['blueprint'];
                     unset($value['blueprint']);
                 }
                 if (isset($value['class'])) {
                     $class = $value['class'];
                     unset($value['class']);
                 }
                 if (isset($value['values'])) {
                     $values = $value['values'];
                     unset($value['values']);
                 }
                 $values = array_merge($values, $value);
                 $obj->{$key} = Blueprint::make($class, $blueprint, $values, true);
             } else {
                 $obj->{$key} = $value;
             }
         }
     }
     if ($commit) {
         $obj->commit();
     }
     return $obj;
 }
예제 #23
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->integer('map_id')->unsigned();
     $table->foreign('map_id')->references('id')->on('maps')->onDelete('cascade');
     $table->integer('round');
     $table->string('win_type')->nullable();
     $table->integer('winner_id')->unsigned();
     $table->foreign('winner_id')->references('id')->on('teams')->onDelete('cascade');
     $table->string('winner_team')->default('t');
     $table->integer('mvp_id')->unsigned();
     $table->foreign('mvp_id')->references('id')->on('players')->onDelete('cascade');
     $table->string('mvp_text')->nullable();
     $table->string('backup_file')->nullable();
     $table->timestamps();
 }
예제 #24
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->integer('map_id')->unsigned();
     $table->foreign('map_id')->references('id')->on('maps')->onDelete('cascade');
     $table->string('steam_id');
     $table->string('username')->nullable();
     $table->bigInteger('kills')->default(0);
     $table->bigInteger('assists')->default(0);
     $table->bigInteger('deaths')->default(0);
     $table->bigInteger('points')->default(0);
     $table->bigInteger('headshots')->default(0);
     $table->bigInteger('plants')->default(0);
     $table->bigInteger('defuses')->default(0);
     $table->bigInteger('teamkills')->default(0);
     $table->bigInteger('1k')->default(0);
     $table->bigInteger('2k')->default(0);
     $table->bigInteger('3k')->default(0);
     $table->bigInteger('4k')->default(0);
     $table->bigInteger('5k')->default(0);
     $table->bigInteger('1v1')->default(0);
     $table->bigInteger('1v2')->default(0);
     $table->bigInteger('1v3')->default(0);
     $table->bigInteger('1v4')->default(0);
     $table->bigInteger('1v5')->default(0);
     $table->bigInteger('entries')->default(0);
     $table->timestamps();
 }
예제 #25
0
 /**
  */
 public function testSum()
 {
     Blueprint::make('Model1', ['int1' => 100, 'str1' => 'testSum']);
     Blueprint::make('Model1', ['int1' => 10, 'str1' => 'testSum']);
     $this->assertEquals(220, Model1::sum(['int1', '+', 'int1'], ['str1' => 'testSum']));
 }
 public function __destruct()
 {
     parent::__destruct();
 }
예제 #27
0
 /**
  * Runs the migrations.
  *
  * @param Blueprint $table
  *
  * @return void
  */
 public function up($table)
 {
     $table->increments('id');
     $table->integer('match_id')->unsigned();
     $table->foreign('match_id')->references('id')->on('matches')->onDelete('cascade');
     $table->string('map')->default('de_dust2');
     $table->integer('score_a')->default(0);
     $table->integer('score_b')->default(0);
     $table->integer('current_round')->default(0);
     /*
      * Statuses:
      * 
      *  0. Not Started
      *  1. Starting
      *  2. Pre-Game Warmup
      *  3. Knife Round
      *  4. Knife Winners Deciding
      *  5. First Half Warmup
      *  6. First Half
      *  7. Second Half Warmup
      *  8. Second Half
      *  9. Overtime Warmup
      * 10. Overtime
      * 11. Finished
      */
     $table->integer('status')->default(0);
     $table->boolean('is_paused')->default(false);
     $table->string('team_paused')->nullable();
     $table->boolean('team_a_unpause')->default(false);
     $table->boolean('team_b_unpause')->default(false);
     $table->string('current_side')->default('ct');
     $table->boolean('t_ready')->default(false);
     $table->boolean('ct_ready')->default(false);
     $table->timestamps();
 }
예제 #28
0
 /**
  * @depends testSelection
  */
 public function testMultipleOr()
 {
     $date = date('Y-m-d H:i:s');
     $models = [Blueprint::make('Model1', ['str1' => "or_test_multiple", 'timestamp1' => $date]), Blueprint::make('Model1', ['int1' => 5715, 'timestamp1' => $date])];
     $res = Model1::selection(["@or" => ['str1' => "or_test_multiple", 'int1' => 5715], "@or:banana" => ["timestamp1" => $date]]);
     $this->assertCount(2, $res);
 }
 private static function prepareData(Blueprint $blueprint, $where = NULL, array $filters = NULL)
 {
     $tag = "EntityExporter::prepareData()";
     Log::notice("{$tag}");
     /*
     // BUILD QUERY
     */
     $query = new EntityQuery($blueprint);
     // WHERE
     if ($where != NULL) {
         $query->where($where);
     }
     // FILTERS
     if ($filters != NULL) {
         foreach ($filters as $key => $value) {
             if (ereg("^filter_(.+)_(.+)", $key, $regs)) {
                 $filter_field = $regs[1];
                 $filter_type = $regs[2];
                 $field = $blueprint->get($filter_field);
                 switch ($field->getDataType()) {
                     case "string":
                         switch ($filter_type) {
                             case "like":
                                 $query->where("{$filter_field} LIKE '%{$value}%'");
                                 break;
                             case "equals":
                                 $query->where("{$filter_field}='{$value}'");
                                 break;
                         }
                         break;
                     case "int":
                         switch ($filter_type) {
                             case "equals":
                                 $query->where("{$filter_field}={$value}");
                                 break;
                             case "min":
                                 $query->where("{$filter_field}>={$value}");
                                 break;
                             case "max":
                                 $query->where("{$filter_field}<={$value}");
                         }
                         break;
                     case "decimal":
                         switch ($filter_type) {
                             case "equals":
                                 $query->where("{$filter_field}='{$value}'");
                                 break;
                             case "min":
                                 $query->where("{$filter_field}>='{$value}'");
                                 break;
                             case "max":
                                 $query->where("{$filter_field}<='{$value}'");
                         }
                         break;
                     case "date":
                     case "datetime":
                         switch ($filter_type) {
                             case "equals":
                                 $query->where("{$filter_field}='{$value}'");
                                 break;
                             case "min":
                                 $query->where("{$filter_field}>='{$value}'");
                                 break;
                             case "max":
                                 $query->where("{$filter_field}<='{$value}'");
                         }
                         break;
                     case "enum":
                         switch ($filter_type) {
                             case "like":
                                 $query->where("{$filter_field} LIKE '%{$value}%'");
                                 break;
                             case "equals":
                                 $query->where("{$filter_field}='{$value}'");
                                 break;
                         }
                         break;
                 }
                 // END: switch($field->getDataType())
             }
             // END: if(ereg("^filter_(.+)_(.+)", $key, $regs))
         }
         // END: foreach($filters as $key=>$value)
     }
     // END: if($filters != NULL)
     // Execute Query
     $sql = new DatabaseQuery($query->toString());
     try {
         $sql->doQuery();
         $num_rows = $sql->get_num_rows();
         Log::debug("{$tag}: Exporting {$num_rows} rows");
         return $sql;
     } catch (Exception $e) {
         Log::error("{$tag}: [" . $sql->err_code . "] " . $sql->err_message);
         throw $e;
     }
 }
예제 #30
0
 /**
  * Get all of the commands with a given name.
  *
  * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
  * @param  string  $name
  * @return array
  */
 protected function getCommandsByName(Blueprint $blueprint, $name)
 {
     return array_filter($blueprint->getCommands(), function ($value) use($name) {
         return $value->name == $name;
     });
 }