| 1 | <?php |
||
| 13 | class AbstractDatabaseQuery |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Address levels в базе ФИАС |
||
| 17 | */ |
||
| 18 | const CITY = 4; |
||
| 19 | const SETTLEMENT = 6; |
||
| 20 | const STREET = 7; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var Connection::newQuery() |
||
| 24 | */ |
||
| 25 | protected $db; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * AbstractDatabaseQuery constructor. |
||
| 29 | * |
||
| 30 | * @uses Connection::newQuery() |
||
| 31 | */ |
||
| 32 | public function __construct() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Первые буквы равны |
||
| 39 | * |
||
| 40 | * @param $letters |
||
| 41 | * |
||
| 42 | * @return $this |
||
| 43 | */ |
||
| 44 | public function firstLetters($letters) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Код региона равен |
||
| 53 | * |
||
| 54 | * @param $code |
||
| 55 | * |
||
| 56 | * @return $this |
||
| 57 | */ |
||
| 58 | public function regionCode($code) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Код КЛАДР равен |
||
| 67 | * |
||
| 68 | * @param $code |
||
| 69 | * |
||
| 70 | * @return $this |
||
| 71 | */ |
||
| 72 | public function kladrCode($code) |
||
| 73 | { |
||
| 74 | $this->db = $this->db->andWhere(['code' => $code]); |
||
| 75 | |||
| 76 | return $this; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * ID родителя равен |
||
| 81 | * |
||
| 82 | * @param $id |
||
| 83 | * |
||
| 84 | * @return $this |
||
| 85 | */ |
||
| 86 | public function parentId($id) |
||
| 92 | |||
| 93 | /** |
||
| 94 | * Получаем массив значений |
||
| 95 | * |
||
| 96 | * @return array |
||
| 97 | */ |
||
| 98 | public function findAll() |
||
| 102 | |||
| 103 | /** |
||
| 104 | * Получаем одно значение |
||
| 105 | * |
||
| 106 | * @return array |
||
| 107 | */ |
||
| 108 | public function findOne() |
||
| 112 | } |