Консольное приложение выполняет импорт базы данных из файла в mysql. Соотвественно я считываю строку за строкой из файла, и по одной записи вставляю в бд
Код: Выделить всё
$databaseFileHandle = fopen($databaseFile, "r");
try {
while (!feof($databaseFileHandle)) {
$databaseFileLine = fgets($databaseFileHandle);
$databaseFileLine = trim($databaseFileLine);
if(strlen($databaseFileLine) > 0) {
$databaseFileLineEncoded = json_decode($databaseFileLine, true);
$this->processPropertyDataComplete($databaseFileLineEncoded);
}
}
} finally {
fclose($databaseFileHandle);
}
Код: Выделить всё
$propertyRoom = new PropertyRoom();
$propertyRoom->native_id = $room["id"];
if(!empty($room["name"])) {
$propertyRoom->name = $room["name"];
}
if(isset($room["descriptions"]) && isset($room["descriptions"]["overview"])) {
$propertyRoom->description_overview = $room["descriptions"]["overview"];
}
$propertyRoom->save();
Кто-то может подстказать в чем проблема?
PHP 7.0.29 (cli) (built: Mar 30 2018 11:03:14) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies