Решил проблему тем, что сделал вот так:
p.s Мне не оч нравится...
<?php
use DiDom\Document;
class Task_Matches extends Minion_Task {
protected static $_timeout = 3;
/**
* @param array $params
*/
protected function _execute(array $params) {
$matches = array();
// Загрузка HTML кода страницы матчей
$document = new Document('http://www.hltv.org/results/', true);
$elements = $document->find('div.matchListRow');
// Преобразование матчей до массива
foreach($elements as $element) {
//Временный багфикс
$match_format = $element->find('div.matchTimeCell');
$team1_name = $element->find('div.matchTeam1Cell');
$team1_logo = $element->find('div.matchTeam1Cell span img');
$result1 = $element->find('div.matchScoreCell span');
$result2 = $element->find('div.matchScoreCell span');
$team2_name = $element->find('div.matchTeam2Cell');
$team2_logo = $element->find('div.matchTeam2Cell span img');
$details = $element->find('div.matchActionCell a');
//Получаем данные 1-го матча
$match = array(
'match_format' => $match_format[0]->text(),
'team1_name' => $team1_name[0]->text(),
'team1_logo' => $team1_logo[0]->attr('src'),
'result1' => $result1[0]->text(),
'result2' => $result2[1]->text(),
'team2_name' => $team2_name[0]->text(),
'team2_logo' => $team2_logo[0]->attr('src'),
'details_link' => $details[0]->attr('href'),
'enabled' => 1,
'date' => time(),
);
$matches[] = $match;
Minion_CLI::write($match['date']);
}
Minion_CLI::write('Detected: '. count($elements) . ' matches');
foreach($matches as $match) {
$match_orm = new Model_Match;
// Загрузка матча, если он уже есть в БД
$match_orm->where('details_link', '=', $match['details_link'])->find();
// Внесение новых данных о матче
$match_orm->values($match);
$match_orm->save();
}
Minion_CLI::write('Ready!');
}
}