Browse Source

SearchPerformance add condition for exists sql array

master
Egorka 6 years ago
parent
commit
bd9296edd1
  1. 20
      core/components/SearchPerformance.php

20
core/components/SearchPerformance.php

@ -8,12 +8,14 @@ namespace core\components;
use Yii;
class SearchPerformance {
public static function init()
{
$connection = Yii::$app->getDb();
$command = $connection->createCommand("
CREATE OR REPLACE VIEW view_search AS " . implode(' UNION ', Yii::$app->params['search_rules']));
$command->execute();
}
}
class SearchPerformance
{
public static function init()
{
if (isset(Yii::$app->params['search_rules']) && is_array(Yii::$app->params['search_rules'])) {
$connection = Yii::$app->getDb();
$command = $connection->createCommand('CREATE OR REPLACE VIEW view_search AS ' . implode(' UNION ', Yii::$app->params['search_rules']));
$command->execute();
}
}
}

Loading…
Cancel
Save