public function actionOperators() { $this->stdout("Загружаю операторов\n", Console::FG_BLUE, Console::BOLD); $query = (new Query())->from($this->operatorTableName); $this->stdout("Источник: таблица '{$this->operatorTableName}' " . $query->count() . " записей.\nЦелевая коллекция: '" . Operator::collectionName() . "'\n"); $this->cleanCollection(Operator::collectionName()); foreach ($query->all() as $item) { $operator = new Operator(['name' => $item['name'], 'contract' => $item['contract'], 'contact' => $item['contact']]); if ($operator->save()) { $this->operatorJunction[$item['id']] = $operator->getPrimaryKey(); } } $this->stdout("Успешно загружено " . count($this->operatorJunction) . " записей\n", Console::BOLD, Console::FG_GREEN); $this->stdout("\n"); return Controller::EXIT_CODE_NORMAL; }