IgorKorytin

Untitled

Sep 4th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1.     public static function all()
  2.     {
  3.         $connection = Yii::app()->db;
  4.         $sql = 'SELECT * FROM `services` ORDER BY name ASC';
  5.         $models = $connection->createCommand($sql)->queryAll();
  6.         $array = array();
  7.         foreach ($models as $one) {
  8.             $array[$one['id']] = $one['name'];
  9.         }
  10.         return $array;
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment