3
* Spring Signage Ltd - http://www.springsignage.com
4
* Copyright (C) 2015 Spring Signage Ltd
5
* (ScheduleConvertStep.php)
9
namespace Xibo\Upgrade;
12
use Xibo\Service\ConfigServiceInterface;
13
use Xibo\Service\LogServiceInterface;
14
use Xibo\Storage\StorageServiceInterface;
17
* Class ScheduleConvertStep
18
* @package Xibo\Upgrade
20
class ScheduleConvertStep implements Step
22
/** @var StorageServiceInterface */
25
/** @var LogServiceInterface */
28
/** @var ConfigServiceInterface */
32
* DataSetConvertStep constructor.
33
* @param StorageServiceInterface $store
34
* @param LogServiceInterface $log
35
* @param ConfigServiceInterface $config
37
public function __construct($store, $log, $config)
39
$this->store = $store;
41
$this->config = $config;
45
* @param \Slim\Helper\Set $container
46
* @throws \Xibo\Exception\NotFoundException
48
public function doStep($container)
50
// Get all events and their Associated display group id's
51
foreach ($this->store->select('SELECT eventId, displayGroupIds FROM `schedule`', []) as $event) {
52
// Ping open the displayGroupIds
53
$displayGroupIds = explode(',', $event['displayGroupIds']);
55
// Construct some SQL to add the link
56
$sql = 'INSERT INTO `lkscheduledisplaygroup` (eventId, displayGroupId) VALUES ';
58
foreach ($displayGroupIds as $id) {
59
$sql .= '(' . $event['eventId'] . ',' . $id . '),';
62
$sql = rtrim($sql, ',');
64
$this->store->update($sql, []);
b'\\ No newline at end of file'