~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Entity/WidgetOption.php

  • Committer: Dan Garner
  • Date: 2016-02-18 16:07:16 UTC
  • mfrom: (454.4.137)
  • Revision ID: git-v1:8867f12675bc9e0e67e7e622c80da7471b9f294a
Merge pull request #139 from dasgarner/feature/nested-display-groups

Feature/nested display groups

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
 
23
23
namespace Xibo\Entity;
24
 
use Xibo\Service\LogServiceInterface;
25
 
use Xibo\Storage\StorageServiceInterface;
26
 
 
 
24
 
 
25
 
 
26
use Xibo\Helper\Log;
 
27
use Xibo\Storage\PDOConnect;
27
28
 
28
29
/**
29
30
 * Class WidgetOption
59
60
     */
60
61
    public $value;
61
62
 
62
 
    /**
63
 
     * Entity constructor.
64
 
     * @param StorageServiceInterface $store
65
 
     * @param LogServiceInterface $log
66
 
     */
67
 
    public function __construct($store, $log)
68
 
    {
69
 
        $this->setCommonDependencies($store, $log);
70
 
    }
71
 
 
72
 
    public function __clone()
73
 
    {
74
 
        $this->widgetId = null;
75
 
    }
76
 
 
77
63
    public function __toString()
78
64
    {
79
65
        if ($this->type == 'cdata') {
86
72
 
87
73
    public function save()
88
74
    {
89
 
        $this->getLog()->debug('Saving ' . $this);
 
75
        Log::debug('Saving ' . $this);
90
76
 
91
 
        $this->getStore()->insert('
 
77
        PDOConnect::insert('
92
78
            INSERT INTO `widgetoption` (`widgetId`, `type`, `option`, `value`)
93
79
              VALUES (:widgetId, :type, :option, :value) ON DUPLICATE KEY UPDATE `value` = :value2
94
80
        ', array(
102
88
 
103
89
    public function delete()
104
90
    {
105
 
        $this->getStore()->update('DELETE FROM `widgetoption` WHERE `widgetId` = :widgetId AND `option` = :option', array(
 
91
        PDOConnect::update('DELETE FROM `widgetoption` WHERE `widgetId` = :widgetId AND `option` = :option', array(
106
92
            'widgetId' => $this->widgetId, 'option' => $this->option)
107
93
        );
108
94
    }